The basics
What is an ICO file?
An ICO file holds an icon: the small picture for a program, a shortcut, a folder or a website's browser tab. What makes it different from a PNG is that one ICO file can hold several versions of the same icon at different sizes and colour depths. Whoever displays it picks the version that fits: 16 pixels for a browser tab, 32 or 48 for a desktop, 256 for a large view in File Explorer.
That matters because small icons aren't just big icons shrunk down. At 16 × 16 pixels, every pixel counts, and designers often simplify the picture or redraw it by hand so it stays readable. An ICO file lets each size be its own image. Our samples make this visible: each image inside shows its own size as a number, so you can see which one an app chose.
You'll meet ICO files in two places:
- Windows. Program icons are stored as ICO data, either as
.icofiles or as resources built into.exeand.dllfiles. Windows also lets you give a folder or shortcut a custom icon from an.icofile. - Websites. The
favicon.icofile at the root of a site is the original way to give it a tab icon, and browsers still look for it.
Anatomy
What's inside an ICO file
An ICO file is a short directory followed by the images it lists. Below are the first bytes of our sample-favicon.ico, which holds a 16, 32 and 48 pixel icon. All numbers are little-endian: the low byte comes first, so 68 04 means 0x0468, which is 1,128.
offset bytes meaning
000000 00 00 reserved
000002 01 00 type 1: icon
000004 03 00 3 images
000006 10 10 00 00 01 00 20 00 68 04 00 00 36 00 00 00 entry 1: 16 × 16
000016 20 20 00 00 01 00 20 00 a8 10 00 00 9e 04 00 00 entry 2: 32 × 32
000026 30 30 00 00 01 00 20 00 a8 25 00 00 46 15 00 00 entry 3: 48 × 48
000036 28 00 00 00 10 00 00 00 20 00 00 00 01 00 20 00 image 1: header
000046 00 00 00 00 … (24 bytes, all 0) image 1: header, rest
00005e ff 55 00 03 ff 6e 03 83 ff 70 04 f2 … image 1: pixels
00045e 00 00 00 00 … (64 bytes) image 1: AND mask
00049e 28 00 00 00 20 00 00 00 40 00 00 00 01 00 20 00 image 2 (32 × 32)
001546 28 00 00 00 30 00 00 00 60 00 00 00 01 00 20 00 image 3 (48 × 48)
003aee end of file: 15,086 bytes- 1
00 00Reserved
Always zero. Together with the next two bytes it forms the signature
00 00 01 00that identifies an icon file. - 2
01 00The type
1 for an icon, 2 for a cursor. A
.curfile is laid out the same way, except that each entry stores the hotspot (the pixel that does the pointing) in place of the planes and bit-depth fields. - 3
03 00The image count
How many images follow: three in this file. The field is 16 bits, so in theory up to 65,535.
- 4
10 10 00 00 01 00 20 00 68 04 00 00 36 00 00 00A directory entry (16 bytes)
Width 0x10 (16), height 16, colour count 0 (no palette), a reserved 0, 1 colour plane, 0x20 (32) bits per pixel, 1,128 bytes of image data, starting at offset 0x36 (54). An app can read every entry and pick a size without decoding any image.
- 5
20 20 … / 30 30 …More entries
The 32 × 32 and 48 × 48 images. Width and height are single bytes, so a 256 × 256 image is stored as 0, as in
sample-app-icon.ico. - 6
28 00 00 00 10 00 00 00 20 00 00 00The bitmap header
A 40-byte BITMAPINFOHEADER, the same as inside a BMP file but without the BMP file header in front. The height says 0x20 (32) for a 16-pixel icon: it counts the colour image and the transparency mask stacked on top of each other.
- 7
ff 55 00 03 …The pixels
Four bytes per pixel in the order blue, green, red, alpha, starting with the bottom row. This first pixel is the bottom-left corner: blue, with an alpha of 3 out of 255, so almost invisible. That's the rounded corner.
- 8
00 00 00 00 … (64 bytes)The AND mask
One bit per pixel, each row padded to 4 bytes. A 1 marks a fully transparent pixel. Before 32-bit alpha, this mask was the only way to make an icon's edges transparent. Here it's all zeros, because every pixel has at least a little opacity and the alpha channel does the work.
- 9
image 2, image 3The other images
Each starts at the offset its directory entry gave. A PNG image would start with
89 50 4E 47instead of a bitmap header; readers tell the two kinds apart by those bytes.
Under the hood
How an ICO file stores its images
The file starts with a 6-byte header and a 16-byte directory entry per image, as the anatomy above shows. Each entry gives the image's size and colour depth and where its data is. The data itself comes in one of two forms:
| Bitmap (BMP-style) image | PNG image | |
|---|---|---|
| Starts with | A 40-byte BITMAPINFOHEADER (28 00 00 00) | The PNG signature (89 50 4E 47 …) |
| Compression | None | PNG's lossless compression |
| Transparency | A 1-bit AND mask, plus an alpha channel in 32-bit images | PNG's own alpha channel |
| Supported by | Windows 3.0 onwards and virtually every ICO reader | Windows Vista and later, browsers and most current tools |
| Typical use | Sizes up to 48 or 64 pixels | 256 × 256, where an uncompressed bitmap would be about 256 KB |
When an app needs an icon at a given size, it reads the directory and picks the closest match, usually preferring a larger image it can scale down over a smaller one it would have to blow up. Which entry wins also depends on the screen's scaling: on a display set to 200%, a 16-pixel tab icon is drawn with a 32-pixel image if there is one. In our tests, Chrome showed the largest image when an ICO file was placed on a page as an ordinary <img>.
Why the height looks doubled
In a bitmap image, the header's height is twice the icon's height, because the colour image (the XOR mask) and the 1-bit transparency mask (the AND mask) are counted together. Code that reads ICO bitmaps by hand must halve it before working with either mask.
On the web
favicon.ico and website icons
Website icons started with Internet Explorer 5 in 1999, which looked for a file called favicon.ico in the root of a site. Browsers still request /favicon.ico when a page doesn't name an icon, which is why that address shows up in server logs even on sites that never made one. A page can point to its icon explicitly instead, and then that wins.
Today a PNG or SVG icon linked from the page does the same job, and MDN's guidance is to prefer those. A common set-up keeps a small favicon.ico for older software and tools that only look at the root, plus an SVG for current browsers and a PNG for Apple devices:
<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">- Sizes for
favicon.ico: 16 and 32 pixels cover browser tabs at normal and double resolution, and 48 is often added as well. That's whatsample-favicon.icocontains. - Larger icons belong elsewhere. Phones and app launchers use the
apple-touch-icon(180 × 180 PNG) and the icons listed in a web app manifest, not the ICO file.
Related formats
ICO vs PNG vs SVG for icons
| ICO | PNG | SVG | |
|---|---|---|---|
| Sizes per file | Several | One | Any: it's vector |
| Windows program and shortcut icons | Yes, the native format | No | No |
| Browser tab icon | Yes, everywhere | Yes | Yes, in most current browsers |
| Hand-tuned small sizes | Yes, one image per size | One file per size | No, one drawing scaled |
| Can follow dark mode | No | No | Yes, with a CSS media query inside |
| Edit with | Icon editors, GIMP | Any image editor | Vector editors, text editor |
Two related formats: .cur is the same container for mouse cursors, with a hotspot per image, and .icns is Apple's own multi-size icon format for macOS apps, which is unrelated in structure.
Troubleshooting
Why is my favicon blurry, missing or not updating?
- It won't update. Browsers cache icons hard, often separately from the page. Reload with the cache bypassed, open the icon's address directly, or change the file name or add a version (
/favicon.ico?v=2) in the<link>. - It's blurry. The file only has one size, so the browser scales it: a 16-pixel image blown up on a high-resolution screen, or a 256-pixel one squeezed into a tab. Include at least 16 and 32 pixels.
- It doesn't show at all. The path is wrong (a relative
favicon.icoon a page in a subfolder looks in that subfolder), the file returns 404, or a redirect sends it to an HTML page. Open the icon's address in a browser to check. - A PNG renamed to
.ico. Browsers usually display it anyway because they look at the content, not the name. Windows, icon editors and strict parsers expect the real ICO layout and may refuse it. Convert it properly instead. - Black or jagged edges in old software. 32-bit icons with an alpha channel need Windows XP or later, and PNG images inside ICO need Vista or later. For very old systems, include a 4- or 8-bit image with an AND mask, like
sample-4bit.ico.
How to
How to create, open and convert an ICO file
- Open it: drag it into a browser, or open it in macOS Preview or GIMP. GIMP shows each image inside as a separate layer.
- Make one from a PNG: with ImageMagick,
magick logo.png -define icon:auto-resize=16,32,48 favicon.icowrites all three sizes into one file. In GIMP, put each size on its own layer and export as.ico. In Python, Pillow'ssave("favicon.ico", sizes=[(16, 16), (32, 32), (48, 48)])does the same. - Start from a large, square image (256 × 256 or more) and check the small sizes by eye. If the 16-pixel version is a smudge, simplify the design for that size.
- Get the PNGs out again:
magick favicon.ico frame.pngwritesframe-0.png,frame-1.pngand so on, one per image. - Use it on Windows: right-click a shortcut or folder, choose Properties, then Change Icon, and browse to the
.icofile.
Free downloads
Sample ICO files to download
Free sample ICO files for testing icon parsers, favicon set-ups, upload filters and image converters. Each image inside shows its own size as a number, so you can tell which one an app picked.
What's inside sample-favicon.ico
A classic three-size favicon, written byte by byte to the layout in Microsoft's documentation. Each image is a different colour as well as showing its size.
Header
The signature
00 00 01 00and an image count of 3.Directory
Three 16-byte entries: 16 × 16, 32 × 32 and 48 × 48, all 32 bits per pixel, with their byte sizes and offsets.
16 × 16, blue
A 40-byte bitmap header, 1,024 bytes of BGRA pixels and a 64-byte AND mask. The rounded corners come from the alpha channel.
32 × 32, green
Same structure, 4,264 bytes. This is the image a browser uses for the tab on a high-resolution screen.
48 × 48, purple
9,640 bytes, the largest image in the file. Chrome uses the largest image when an ICO is shown as an ordinary page image, so in Chrome the preview above shows 48.
All sample ICO files
Multi-size favicon
sample-favicon.ico · 14.7 KB (15,086 bytes)
A favicon with 16, 32 and 48 pixel images, all 32-bit bitmaps with alpha. The most widely compatible kind of ICO file.
- Testing which size a browser or app picks
- A drop-in placeholder `favicon.ico`
Windows app icon with a 256 px PNG
sample-app-icon.ico · 38.4 KB (39,278 bytes)
Six images: 16, 24, 32, 48 and 64 pixels as bitmaps, plus 256 × 256 as a PNG, stored with a width and height of 0 in the directory. Covers the minimum set Microsoft lists for app icons.
- Testing readers that must handle mixed bitmap and PNG images
- Checking the 0-means-256 rule
Single 16 × 16 icon
sample-16x16.ico · 1.1 KB (1,150 bytes)
The smallest useful favicon: one 16-pixel 32-bit image. On high-resolution screens it will look soft, which is the point of comparing it with the multi-size file.
- Minimal parser tests
- Seeing what a single small size looks like on a sharp screen
Single 256 × 256 PNG icon
sample-png-256.ico · 4.7 KB (4,790 bytes)
One PNG-compressed image, the kind many online converters produce. The PNG carries a text comment pointing back to this page.
- Testing PNG-in-ICO support
- Checking downscaling quality at 16 and 32 pixels
Legacy 16-colour icon
sample-4bit.ico · 1.1 KB (1,078 bytes)
32 and 16 pixel images in 4 bits per pixel, using the classic 16-colour Windows palette, with transparency from the 1-bit AND mask only.
- Testing palette and AND-mask decoding
- Old-software compatibility checks
Ways to test with them
- Size selection: set
sample-favicon.icoas a page's icon and look at the tab: on a normal screen you should see 16, on a high-resolution one 32. - Parsers: load all five files with your library.
sample-app-icon.icochecks PNG images and the 0-means-256 rule;sample-4bit.icochecks palettes and the AND mask. - Converters: convert
sample-app-icon.icoto PNG and check which size comes out. Many tools pick the largest or the first without saying so. - Upload filters: some filters check the
image/x-iconorimage/vnd.microsoft.icontype, others the00 00 01 00signature. Try each sample to see which pass.
Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.
Put it online
Have an ICO file? Give it a link.
Drop an ICO file on 99helpers and it gets its own address in seconds, so you can share an icon or point a page at it. Browsers that open the link show the icon.
Questions
ICO files, frequently asked
What is an ICO file?
An icon file: a small container holding the same picture at one or more sizes, used for Windows program icons and website favicons.
How do I open an ICO file?
Drag it into a web browser, or open it in macOS Preview or GIMP. On Windows, File Explorer shows it as the file's own icon.
How do I make a favicon.ico?
Start from a square image of at least 256 × 256 pixels and convert it with a tool that writes several sizes, such as ImageMagick: magick logo.png -define icon:auto-resize=16,32,48 favicon.ico.
What sizes should a favicon.ico contain?
16 × 16 and 32 × 32 pixels at minimum, often with 48 × 48 added. Larger icons for phones and app launchers are usually separate PNG files.
Do I still need a favicon.ico?
It isn't required, since browsers accept PNG and SVG icons linked from the page. Many sites keep one anyway, because browsers and other tools request /favicon.ico by default.
Can I just rename a PNG to .ico?
Browsers will often display it, since they check the content. Windows and strict ICO readers won't treat it as a real icon. Convert it with a proper tool instead.
What's the MIME type of an ICO file?
The registered type is image/vnd.microsoft.icon. image/x-icon is an older, unofficial type that is still widely used, and browsers accept both.
What is the maximum size of an ICO image?
256 × 256 pixels per image in the directory. Larger images can technically be stored, but Microsoft doesn't recommend it and many readers won't handle them.
Why does my favicon not update?
Browsers cache icons aggressively. Clear the cache or change the icon's URL, for example by adding ?v=2 to the href in your <link> tag.
Related formats
Other file types explained
Keep going
Related
Sources
- Microsoft: Icons (ICO file structure)
- IANA: image/vnd.microsoft.icon registration
- Microsoft: App icon construction
- MDN: Image file type and format guide (ICO)
- Wikipedia: ICO (file format)
- Wikipedia: Favicon
Last reviewed 27 October 2026.