Daub Logo
Products Downloads Buy Company Community my Daubnet


Business Software:   Home and Family:
Load! - Container Optimization   Ages! - Family Tree Software

File Format Specification Index



Basic Description

Windows uses ICO files to display its Icons. There can (and for compatibility's sake should) be more than 1 picture in an ICO file. For general purpose ICOs there should be at least one 32x32 image using the 16 Windows colors.

Basic File Format

Name Size Description
Reserved 2 byte =0
Type 2 byte =1
Count 2 byte Number of Icons in this file
Entries Count * 16 List of icons
  Width 1 byte Cursor Width (16, 32 or 64)
  Height 1 byte Cursor Height (16, 32 or 64 , most commonly = Width)
  ColorCount 1 byte Number of Colors (2,16, 0=256)
  Reserved 1 byte =0
  Planes 2 byte =1
  BitCount 2 byte bits per pixel (1, 4, 8)
  SizeInBytes 4 byte Size of (InfoHeader + ANDbitmap + XORbitmap)
  FileOffset 4 byte FilePos, where InfoHeader starts
repeated Count times
InfoHeader 40 bytes Variant of BMP InfoHeader
  Size 4 bytes Size of InfoHeader structure = 40
  Width 4 bytes Icon Width
  Height 4 bytes Icon Height (added height of XOR-Bitmap and AND-Bitmap)
  Planes 2 bytes number of planes = 1
  BitCount 2 bytes bits per pixel = 1, 4, 8
  Compression 4 bytes Type of Compression = 0
  ImageSize 4 bytes Size of Image in Bytes = 0 (uncompressed)
  XpixelsPerM 4 bytes unused = 0
  YpixelsPerM 4 bytes unused = 0
  ColorsUsed 4 bytes unused = 0
  ColorsImportant 4 bytes unused = 0
Colors NumberOfColors * 4 bytes Color Map for XOR-Bitmap
  Red 1 byte red component
  Green 1 byte green component
  Blue 1 byte blue component
  reserved 1 byte =0
repeated NumberOfColors times
XORBitmap see below bitmap
ANDBitmap see below monochrome bitmap

Raster Data encoding

The XOR Bitmap is stored as 1-bit, 4-bit or 8-bit uncompressed Bitmap using the same encoding as BMP files. The AND Bitmap is stored in as 1-bit uncompressed Bitmap.
Pixels are stored bottom-up, left-to-right. Pixel lines are padded with zeros to end on a 32bit (4byte) boundary. Every line will have the same number of bytes. Color indices are zero based, meaning a pixel color of 0 represents the first color table entry, a pixel color of 255 (if there are that many) represents the 256th entry.

Raster Data encoding for 1bit / black & white XORbitmaps and for the AND-bitmap

BitCount = 1 Compression = 0
Every byte holds 8 pixels, its highest order bit representing the leftmost pixel of those. There are 2 color table entries. Some readers will ignore them though, and assume that 0 is black and 1 is white. If you are storing black and white pictures you should stick to this, with any other 2 colors this is not an issue. Remember padding with zeros up to a 32bit boundary (This can be up to 31 zeros/pixels!)

Raster Data encoding for 4bit / 16 color XORbitmaps

BitCount = 4 Compression = 0
Every byte holds 2 pixels, its high-order 4 bits representing the left of those. There are 16 color table entries. These colors do not have to be the 16 MS-Windows standard colors. Padding each line with zeros up to a 32bit boundary will result in up to 28 zeros = 7 'wasted pixels'.

Raster Data encoding for 8bit / 256 color XORbitmaps

BitCount = 8 Compression = 0
Every byte holds 1 pixel. There are 256 color table entries. Padding each line with zeros up to a 32bit boundary will result in up to 3 bytes of zeros = 3 'wasted pixels'.


Since ICO Files are a derivatives of BMPs they should be quite easily converted into two BMPs, one holding the (possibly colored) XOR Image and one holding the monochrome AND Image. Due to the XOR-AND-scheme which may not apply to other OS, these files are not very portable, and were never intended to be. 2byte and 4byte entries are stored in Intel order (Least significant byte first)

Trademarks, Patents and Royalties

To my knowledge: none
(please read the disclaimer)

Cross-Checking Software

This section is for programmers, who wish to cross-check their implementation with others. This is an incomplete list of programs, which are available as freeware / shareware / try-before-buy etc.
The following software is able to decode ICOs::
  • Windows itself (obviously not freeware)
  • most resource construction sets (included in Windows Compilers)
The following software is able to encode ICOs
  • most resource construction sets (included in Windows Compilers)

Online Resources



This is not the official format documentation. Although we're doing our best to keep this information as accurate as possible, there is no way of checking all of it under all possible circumstances. We're not taking any responsibility for the results of these information or lack thereof. The 'trademarks, patents and royalties' section is here just for your convenience, and is in no way complete. Please send us a note, if you find any incorrect of missing information.