What Is ICO Format?
ICO (Icon) is a file format used for icons in Microsoft Windows and as favicons for websites. Developed by Microsoft and first introduced with Windows 1.0 in 1985, the ICO format has evolved significantly over the decades. Its defining characteristic is the ability to store multiple images of different sizes and color depths within a single file, allowing operating systems and browsers to select the most appropriate version for each display context.
Files use the .ico extension. A related format, CUR (Cursor), uses the same structure but adds hotspot coordinates for cursor positioning.
ICO File Structure
ICO files use a simple binary structure:
ICO File
βββ ICONDIR Header (6 bytes)
β βββ Reserved: 0x0000 (2 bytes)
β βββ Type: 0x0001 (2 bytes) [1 = ICO, 2 = CUR]
β βββ Image Count: N (2 bytes)
β
βββ ICONDIRENTRY[0] (16 bytes per image)
β βββ Width: 0-255 (1 byte) [0 = 256]
β βββ Height: 0-255 (1 byte) [0 = 256]
β βββ Color Count: (1 byte) [0 if > 8-bit]
β βββ Reserved: 0x00 (1 byte)
β βββ Planes: (2 bytes)
β βββ Bit Count: color depth (2 bytes)
β βββ Size of image data (4 bytes)
β βββ Offset to image data (4 bytes)
β
βββ ICONDIRENTRY[1]
β βββ [...]
β
βββ Image Data[0]
β βββ Option A: BMP DIB (BITMAPINFOHEADER + XOR mask + AND mask)
β βββ Option B: PNG (complete PNG file, zlib-compressed, stored verbatim)
β
βββ Image Data[N-1]
Image Sizes in ICO Files
Windows uses different icon sizes for different contexts. A comprehensive ICO file for a Windows application should contain all these sizes:
| Size | Color depth | Use context |
|---|---|---|
| 16Γ16 | 32-bit RGBA | Taskbar, small toolbar icons |
| 24Γ24 | 32-bit RGBA | Toolbar icons in some apps |
| 32Γ32 | 32-bit RGBA | Desktop (medium icons), standard toolbar |
| 40Γ40 | 32-bit RGBA | Some Windows 10+ contexts |
| 48Γ48 | 32-bit RGBA | Desktop (large icons), Windows Explorer |
| 64Γ64 | 32-bit RGBA | Desktop (extra large icons) |
| 128Γ128 | 32-bit RGBA | Windows 10+ large icon view |
| 256Γ256 | PNG format | Desktop (huge icons), Windows 10/11 |
For Windows application icons, the minimum recommended set is 16Γ16, 32Γ32, 48Γ48, and 256Γ256. The 256Γ256 image must be stored as a PNG (not BMP) per the Vista+ specification.
ICO Image Encoding: BMP vs. PNG
ICO files can store images in two formats:
BMP (DIB) Encoding (Legacy)
Pre-Vista ICO images use BMP Device Independent Bitmap encoding:
- BITMAPINFOHEADER (40 bytes): width, heightΓ2 (height is doubled to account for XOR+AND masks), planes, bit count
- Optional color table
- XOR mask: the actual pixel data (BGRA order for 32-bit)
- AND mask: 1-bit transparency mask (0=opaque, 1=transparent)
For 32-bit BMP images in ICO, the alpha channel from the BGRA data is used, and the AND mask is typically all zeros. For older color depths (1-bit, 4-bit, 8-bit), the AND mask controls transparency.
PNG Encoding (Vista and Later)
Windows Vista and later allow 256Γ256 (and potentially other sizes) to be stored as complete, zlib-compressed PNG files embedded verbatim in the ICO data section. PNG encoding:
- Dramatically smaller than equivalent BMP for large images
- Supports full 32-bit RGBA (alpha channel)
- Any size can theoretically be PNG-encoded, but 256Γ256 is the primary use case
Favicon: ICO for the Web
The most common use of ICO in 2024 is as a favicon β the small icon displayed in browser tabs, bookmarks, history, and address bars.
Standard Favicon Setup
The minimum favicon is a single favicon.ico file in the website root:
<link rel="icon" href="/favicon.ico" type="image/x-icon">
However, modern websites should provide multiple formats and sizes for optimal display across all contexts:
<!-- Legacy ICO for old browsers -->
<link rel="icon" href="/favicon.ico" sizes="32x32">
<!-- Modern PNG favicons for current browsers -->
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<!-- Apple Touch Icon (iOS home screen bookmark) -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<!-- SVG favicon (scalable, supported in Firefox and Chrome) -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<!-- Web App Manifest for PWA -->
<link rel="manifest" href="/site.webmanifest">
Browsers and Favicon Formats
| Browser | ICO | PNG | SVG |
|---|---|---|---|
| Chrome | β | β | β (since v80) |
| Firefox | β | β | β (since v41) |
| Safari | β | β | Limited |
| Edge | β | β | β |
SVG favicons are the modern best practice for websites β a single SVG file scales to any size perfectly. Firefox and Chrome use the SVG when available; older browsers fall back to ICO.
Touch Icons
Apple iOS uses "Apple Touch Icon" images when a user adds a website to their home screen. These are regular PNG images at specific sizes:
- 180Γ180 px for modern iPhones (Retina displays)
- 152Γ152 px for iPad Retina
- 120Γ120 px for older iPhones
These are referenced with <link rel="apple-touch-icon"> and should be flat PNG images without rounded corners (iOS rounds them automatically).
Color Depths in ICO
ICO has evolved through several color depth standards:
| Color depth | Colors | Use |
|---|---|---|
| 1-bit | 2 (monochrome) | Early Windows icons |
| 4-bit | 16 | Windows 3.x era |
| 8-bit | 256 (palette) | Windows 95/98 era |
| 24-bit | 16.7 million | True color without transparency |
| 32-bit | 16.7 million + 8-bit alpha | Modern icons β RGBA |
Modern ICO files should use 32-bit color depth for all images. The 32-bit format stores full BGRA data, providing smooth transparency for drop shadows and anti-aliased edges β critical for modern high-DPI icons.
Creating ICO Files
From Command Line (ImageMagick)
# Create ICO with multiple sizes from a single PNG
magick convert icon-256.png \
\( -clone 0 -resize 256x256 \) \
\( -clone 0 -resize 128x128 \) \
\( -clone 0 -resize 64x64 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 16x16 \) \
-delete 0 favicon.ico
# Simpler version (let ImageMagick pick sizes)
magick convert icon.png -define icon:auto-resize=256,128,64,48,32,16 favicon.ico
From GIMP
File β Export As β choose .ico β dialog asks for which sizes to include
Online Tools
- RealFaviconGenerator.net β generates complete favicon package with ICO + PNG + manifest
- favicon.io β converts PNG/text/emoji to ICO + PNG set
- icoconvert.com β simple ICO conversion
ICO vs. SVG for Modern Applications
| Use case | ICO | SVG |
|---|---|---|
| Windows application icon | β Required | β |
| Windows taskbar/desktop | β | β |
| Browser favicon (modern) | Works | β Better (scales perfectly) |
| macOS application icon | β (use ICNS) | β |
| Progressive Web App | β + PNG | β Best |
| Email favicon | β | β |
For Windows applications, ICO is still required by the OS. For web favicons, SVG + ICO fallback is the modern best practice. For macOS, Apple uses the ICNS format (a similar multi-size container for Mac icons).