Inside an ICO file: how the format works
An ICO file starts with a six-byte header: two reserved bytes, a type field (1 for icons, 2 for cursors) and the number of images. A 16-byte directory entry follows for each image, giving its width, height, colour count, planes, bits per pixel, data size and the offset where its data begins.
Width and height each occupy a single byte, so the largest value they can hold is 255. The format uses 0 to mean 256, which is why 256 × 256 is the ceiling for ICO entries.
BMP or PNG data?
- BMP (DIB) entries store raw pixels bottom-up with a height field doubled to cover the colour data plus a 1-bit transparency mask. With 32-bit colour, the alpha byte handles soft edges.
- PNG entries store a complete compressed PNG. They are much smaller for large sizes and are standard for 256 px icons on Windows Vista and later.
This generator uses BMP for the eight smaller entries and PNG for the largest, a combination that Windows and every major browser read without complaint.
Windows icon sizes and where they appear
Windows chooses an entry based on the view and the display's scaling setting, so including several resolutions prevents blurry upscaling.
- 16 × 16 – title bars, the notification area and Explorer's details view.
- 24 and 32 px – the taskbar, Start menu tiles and small icons at 125–200% scaling.
- 48 × 48 – medium icons on the desktop and in Explorer.
- 64 to 128 px – large icon views on high-DPI screens.
- 256 × 256 – extra-large icons and file previews.
macOS uses a different container, ICNS, for application icons, and Linux desktops normally use PNG or SVG files. For cross-platform apps you usually keep a large PNG master and generate each format from it.
Using a generated ICO in apps, folders and websites
Desktop applications
Most Windows build tools accept an .ico for the program icon. Visual Studio projects reference it in the application settings, and Electron packagers such as electron-builder expect an icon.ico of at least 256 × 256 px for Windows targets.
Folder icons
To give a folder a custom icon, place the ICO inside it and add a hidden desktop.ini file. Windows also lets you pick an icon from the folder's Properties → Customize tab.
[.ShellClassInfo]
IconResource=app-icon.ico,0
Websites
Rename the file to favicon.ico, upload it to your domain root and declare it with <link rel="icon" href="/favicon.ico" sizes="any">. For dedicated favicon advice, see the favicon generator page. If your artwork is a JPEG, the JPG to ICO guide explains how to handle the missing transparency.