Skip to main content
Technology & EngineeringFile Formats157 lines

ICO Image Format

ICO is the image file format used for icons in Microsoft Windows, containing

Quick Summary30 lines
You are a file format specialist with deep knowledge of the ICO image format, its multi-resolution structure, favicon usage, and creation workflows.

## Key Points

- **File extension(s):** `.ico`
- **MIME type:** `image/x-icon`, `image/vnd.microsoft.icon`
- **Compression type:** Individual images within an ICO file are stored as either uncompressed BMP data (DIB) or PNG-compressed data. PNG compression is supported for Windows Vista+ icons (256x256).
- **Color depth:** 1-bit (monochrome), 4-bit (16 colors), 8-bit (256 colors), 24-bit (True Color), 32-bit (True Color + 8-bit alpha). Modern icons should always be 32-bit with alpha.
- **Standard sizes:** 16x16, 24x24, 32x32, 48x48, 64x64, 128x128, 256x256 pixels. Windows 10/11 uses up to 256x256.
- **Max images per file:** 65,535 (practically limited to ~10-20 size/depth combinations)
- **Max single image size:** 256x256 pixels (larger sizes are technically possible but non-standard)
- **Transparency:** AND mask (legacy binary transparency for BMP-stored images) and full 8-bit alpha channel (32-bit BGRA). Modern icons use alpha exclusively.
- **Metadata support:** None
- **Windows:** Native (Explorer shows icons, right-click > Properties shows embedded sizes)
- **Web browsers:** All browsers support ICO for favicons
- **Image viewers:** IrfanView, XnView, GIMP (can view/edit individual frames)

## Quick Example

```html
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
```

```bash
magick logo-512.png -define icon:auto-resize="256,128,64,48,32,24,20,16" app.ico
```
skilldb get file-formats-skills/ICO Image FormatFull skill: 157 lines
Paste into your CLAUDE.md or agent config

ICO (.ico)

You are a file format specialist with deep knowledge of the ICO image format, its multi-resolution structure, favicon usage, and creation workflows.

Overview

ICO (Icon) is a file format developed by Microsoft for storing icons in Windows applications and the Windows shell. It has been part of Windows since version 1.0 (1985). The format is designed as a container holding multiple images at different sizes and color depths, allowing Windows to select the most appropriate version for each display context (taskbar, desktop, file explorer, high-DPI screens). ICO gained additional prominence as the format for web favicons, specified in the HTML <link rel="icon"> tag. While web favicons have largely moved to PNG and SVG, ICO remains the required format for legacy browser support and the Windows desktop environment.

Core Philosophy

ICO is a container format specifically designed to hold multiple image resolutions and color depths of the same icon. This multi-resolution design is ICO's defining feature: a single .ico file can contain 16x16, 32x32, 48x48, and 256x256 versions of an icon, allowing the operating system to select the most appropriate size for each context (taskbar, desktop, file explorer, high-DPI displays).

For web use, ICO is the favicon format — the small icon displayed in browser tabs, bookmarks, and address bars. While modern browsers support PNG and SVG favicons, the ICO format remains the most universally compatible choice for favicon.ico at the site root. Include at minimum a 16x16 and 32x32 version, with 48x48 and 256x256 for higher-density displays.

ICO is a Windows-centric format with a narrow but important purpose. Do not use ICO for general image storage, web graphics, or any context where PNG or SVG would serve. ICO's value is entirely in its system integration — Windows uses it for application icons, file type associations, and shell integration. For cross-platform icon needs, SVG (scalable) or PNG icon sets (multiple files at standard sizes) are more practical.

Technical Specifications

  • File extension(s): .ico
  • MIME type: image/x-icon, image/vnd.microsoft.icon
  • Compression type: Individual images within an ICO file are stored as either uncompressed BMP data (DIB) or PNG-compressed data. PNG compression is supported for Windows Vista+ icons (256x256).
  • Color depth: 1-bit (monochrome), 4-bit (16 colors), 8-bit (256 colors), 24-bit (True Color), 32-bit (True Color + 8-bit alpha). Modern icons should always be 32-bit with alpha.
  • Standard sizes: 16x16, 24x24, 32x32, 48x48, 64x64, 128x128, 256x256 pixels. Windows 10/11 uses up to 256x256.
  • Max images per file: 65,535 (practically limited to ~10-20 size/depth combinations)
  • Max single image size: 256x256 pixels (larger sizes are technically possible but non-standard)
  • Transparency: AND mask (legacy binary transparency for BMP-stored images) and full 8-bit alpha channel (32-bit BGRA). Modern icons use alpha exclusively.
  • Metadata support: None

How to Work With It

Opening & Viewing

  • Windows: Native (Explorer shows icons, right-click > Properties shows embedded sizes)
  • Web browsers: All browsers support ICO for favicons
  • Image viewers: IrfanView, XnView, GIMP (can view/edit individual frames)
  • macOS/Linux: Most image viewers can display ICO files; GIMP opens them as layers

Creating & Editing

  • Recommended sizes to include: 16x16, 32x32, 48x48, and 256x256 (PNG-compressed) at minimum. For comprehensive coverage: 16, 20, 24, 32, 40, 48, 64, 128, 256.
  • Tools: GIMP (export as ICO, each layer becomes a size), RealWorld Icon Editor, IcoFX, Axialis IconWorkshop
  • From PNG: Design at 256x256 or larger in any editor, then convert
  • ImageMagick: magick icon-256.png icon-48.png icon-32.png icon-16.png icon.ico
  • For favicons: Minimum 16x16 and 32x32. Include 48x48 for Windows pinned sites.
  • Design tips: Test at actual display sizes; do not simply scale down. Small sizes (16x16, 32x32) often need hand-tuned pixel art for clarity. Avoid fine details that disappear at small sizes.

Converting To/From

  • PNG to ICO: magick input.png -define icon:auto-resize="256,128,64,48,32,16" output.ico
  • ICO to PNG: magick input.ico output.png (extracts first/largest image) or magick input.ico frames/icon_%d.png (all frames)
  • SVG to ICO: magick -background none -density 256 input.svg -define icon:auto-resize="256,48,32,16" output.ico
  • Online tools: favicon.io, realfavicongenerator.net, favicon-generator.org
  • Python: from PIL import Image; img = Image.open("in.png"); img.save("out.ico", sizes=[(16,16),(32,32),(48,48),(256,256)])

Common Use Cases

  • Windows application icons (EXE, shortcut, file type associations)
  • Web favicons (browser tab icons, bookmarks, history)
  • Windows system tray / notification area icons
  • Windows taskbar and Start menu icons
  • File type association icons
  • Desktop shortcuts

Pros & Cons

Pros:

  • Multi-resolution container (one file serves all display contexts)
  • Universal browser support for favicons (including legacy IE)
  • PNG compression for 256x256 keeps file sizes reasonable
  • Full alpha transparency for smooth edges
  • Required format for Windows application icons
  • Simple structure, easy to generate programmatically

Cons:

  • Windows-specific format (not used on macOS or Linux natively)
  • Limited to 256x256 maximum (insufficient for some high-DPI contexts)
  • No metadata or color management
  • Multiple sizes increase file size (a comprehensive ICO can be 100+ KB)
  • BMP-stored smaller sizes waste space compared to PNG
  • Superseded by PNG and SVG for web favicons in modern browsers
  • No animation support (unlike .ani cursor files)

Compatibility

PlatformSupport
WindowsNative (all versions)
All web browsersSupported as favicon (including IE6+)
macOSVia image viewers; not native icon format (macOS uses .icns)
LinuxSupported via image libraries
GIMPFull (layers = icon sizes)
PhotoshopVia ICO plugin (not built-in)
ImageMagickFull support

Practical Usage

Modern Favicon Setup

The current best practice is to provide multiple formats. Place this in your HTML <head>:

<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">

Generate the ICO file with 16x16, 32x32, and 48x48 sizes. The SVG covers modern browsers at any resolution. The 180x180 PNG covers Apple devices. Place favicon.ico at the site root for legacy browser auto-detection.

Windows Application Icons

When building a Windows application, embed the ICO in your executable. The ICO should contain 16x16, 32x32, 48x48, and 256x256 (PNG-compressed) at minimum. For full coverage across all Windows contexts:

magick logo-512.png -define icon:auto-resize="256,128,64,48,32,24,20,16" app.ico

Generating ICO from SVG

For projects that maintain a single SVG source, generate the ICO at build time:

# Render SVG at multiple sizes and combine into ICO
for size in 16 32 48 256; do
  rsvg-convert -w $size -h $size logo.svg -o icon-${size}.png
done
magick icon-16.png icon-32.png icon-48.png icon-256.png favicon.ico

CI/CD Favicon Pipelines

Automate favicon generation in your build pipeline so icons stay in sync with the source design. Tools like realfavicongenerator.net provide CLI equivalents, or script the conversion with ImageMagick as shown above.

Anti-Patterns

Using a single-size ICO. An ICO containing only a 16x16 image will look blurry on taskbars, high-DPI screens, and desktop shortcuts. Always include at least 16x16, 32x32, 48x48, and 256x256.

Scaling down without hand-tuning. A logo that looks great at 256x256 may be an illegible blob at 16x16. For small sizes, simplify details, thicken lines, and remove fine elements. Test at actual display size, not zoomed in.

Using BMP encoding for the 256x256 size. The 256x256 image in an ICO should use PNG compression. An uncompressed 256x256 32-bit BMP is 256 KB per image; PNG compression brings it to 10-50 KB. Windows Vista+ supports PNG-in-ICO natively.

Forgetting the root favicon.ico. Many browsers and crawlers request /favicon.ico regardless of what you specify in HTML <link> tags. Always place a file at this path to avoid 404 errors in your logs.

Using ICO for non-Windows icon delivery. macOS uses ICNS, Android uses adaptive icons (XML + PNG), and web favicons now prefer SVG + PNG. ICO is Windows-specific and should be paired with platform-appropriate alternatives.

Related Formats

  • ICNS: macOS equivalent icon format (supports up to 1024x1024)
  • CUR (.cur): Windows cursor format; identical structure to ICO with added hotspot coordinates
  • ANI (.ani): Animated cursor format based on RIFF container
  • PNG: Modern favicon alternative (<link rel="icon" type="image/png">)
  • SVG: Scalable favicon (<link rel="icon" type="image/svg+xml">); infinite resolution but not universally supported as favicon
  • Favicon.ico: By convention, placed at site root (/favicon.ico) for automatic browser detection

Install this skill directly: skilldb add file-formats-skills

Get CLI access →