The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately. In Windows, all executables that display an icon to the user, on the desktop, in the Start Menu, or in file Explorer, must carry the icon in ICO format.

The CUR file format is an almost identical image file format for non-animated cursors in Microsoft Windows. The only differences between these two file formats are the bytes used to identify them and the addition of a hotspot in the CUR format header; the hotspot is defined as the pixel offset (in x,y coordinates) from the top-left corner of the cursor image to where the user is actually pointing the mouse.

The ANI file format is used for animated Windows cursors.

History

Icons introduced in Windows 1.0 were 32×32 pixels in size and were monochrome. Support for 16 colors was introduced in Windows 3.0.

Win32 introduced support for storing icon images of up to 16.7 million colors (TrueColor) and up to 256×256 pixels in dimensions. Windows 95 also introduced a new Device Independent Bitmap (DIB) engine. However, 256 color was the default icon color depth in Windows 95. It was possible to enable 65535 color (Highcolor) icons by either modifying the Shell Icon BPP value in the registry or by purchasing Microsoft Plus! for Windows 95. The Shell Icon Size value allows using larger icons in place of 32×32 icons and the Shell Small Icon Size value allows using custom sizes in place of 16×16 icons. Windows XP can downscale larger icons if no closer image size is available.

The SM_CXCURSOR and SM_CYCURSOR system metric in Windows reports the nominal size of the cursor, typically 32 pixels on classic systems. This metric does not reflect the maximum or actual size of all cursors used in the system. Windows commonly loads 32×32 cursors by default but also supports other sizes such as 48×48 or 64×64 pixels depending on display scaling and resolution. The metric serves as a guideline value for resource design and alignment rather than a strict constraint. Actual cursor sizes can vary, especially in modern high-DPI environments. The metric originates from legacy design decisions and remains primarily for compatibility with older applications.

MIME type

While the IANA-registered MIME type for ICO files is <code>image/vnd.microsoft.icon</code>, it was submitted to IANA in 2003 by a third party and is not recognised by Microsoft software, which uses <code>image/x-icon</code> or <code>image/ico</code> instead. Erroneous types <code>image/ico</code>, <code>image/icon</code>, <code>text/ico</code> and <code>application/ico</code> have also been seen in use.

32-bit images (including 32-bit BITMAPINFOHEADER-format BMP images) are specifically a 24-bit image with the addition of an 8-bit channel for alpha compositing. Thus, in 32-bit images, the AND mask is not required, but recommended for consideration. Windows XP and higher will use a 32-bit image in less than True color mode by constructing an AND mask based on the alpha channel (if one does not reside with the image already) if no 24-bit version of the image is supplied in the ICO/CUR file. However, earlier versions of Windows interpret all pixels with 100% opacity unless an AND mask is supplied with the image. Supplying a custom AND mask will also allow for tweaking and hinting by the icon author. Even if the AND mask is not supplied, if the image is in Windows BMP format, the BMP header must still specify a doubled height.

It's important to note that in the AND mask, as for the pixel array of the bitmap, padding bytes must be appended to the end of each row in order to bring up its length to a multiple of four bytes since it's basically a (monochrome) bitmap.

|-

| 1 || bHeight || 1 || Image height in pixels. Can be any number between 0 and 255. 0 means height is 256.

  • In CUR format: Specifies the horizontal coordinates of the hotspot in number of pixels from the left.

|-

| 6 || wBitCount || 2 ||

  • In ICO format: Specifies bits per pixel.
  • In CUR format: Specifies the vertical coordinates of the hotspot in number of pixels from the top.

and resources contain one NEWHEADER structure and one or more RESDIR structures which have almost the same format as corresponding and structures in ICO/CUR files. Main difference is in that the last member of the structure contains two-byte resource identifier of the / instead of image offset in the file.

/ structures also referred as / in many sources.

NEWHEADER structure

{| class="wikitable"

|-

! Offset<br>(bytes)

! Field

! Size<br>(bytes)

! Description

|-

| 0

| Reserved

| 2

| Reserved. Must be 0.

|-

| 2

| ResType

| 2

| Resource type: 1 for icon, 2 for cursor. Other values are invalid.

|-

| 4

| ResCount

| 2

| Number of RESDIR structures that immediately follow this structure.

|}

RESDIR structure

{| class="wikitable"

|-

! Offset<br>(bytes)

! Field

! Size<br>(bytes)

! Description

|-

| 0

| Width

| 1 (ICO) or 2&nbsp;(CUR)

| Image width in pixels. Can be any number between 0 and 255. 0 means width is 256.

Icon library

An icon library is a way to package Windows icons. It is typically a 16-bit New Executable or a 32-bit Portable Executable binary file having an .ICL extension with icon resources being the packaged icons. Windows Vista and later versions do not support viewing icons from 16-bit (New Executable) files.

See also

  • Apple Icon Image format
  • BMP file format
  • Computer icon
  • Favicon
  • List of icon software

Notes