File types · Explainer

The ICO file (.ico)

An ICO file is a small container that holds the same icon at several sizes, used for Windows program icons and website favicons. This guide explains what's inside one, how apps pick a size, the favicon quirks worth knowing, and has free sample ICO files to download for testing.

At a glance

Full name
Windows icon file (ICO)
Extensions
.ico; cursors use the same layout as .cur
MIME type
image/vnd.microsoft.icon (registered 2003); image/x-icon is widely used
Kind
Binary container of one or more images, each a BMP-style bitmap or a PNG
Owner
Microsoft
First released
Icons date from Windows 1.0 (1985); the multi-image ICO layout from Windows 3.0 (1990)
Opens with
Web browsers, Windows File Explorer, macOS Preview, GIMP, icon editors
Image sizes
1 × 1 to 256 × 256 pixels per image; a stored 0 means 256
Colour depths
Usually 1, 4, 8 or 32 bits per pixel; 32-bit with alpha since Windows XP, PNG images since Windows Vista
Magic number
00 00 01 00 (cursors: 00 00 02 00)

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 .ico files or as resources built into .exe and .dll files. Windows also lets you give a folder or shortcut a custom icon from an .ico file.
  • Websites. The favicon.ico file 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.

sample-favicon.ico (hex)
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. 100 00

    Reserved

    Always zero. Together with the next two bytes it forms the signature 00 00 01 00 that identifies an icon file.

  2. 201 00

    The type

    1 for an icon, 2 for a cursor. A .cur file 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. 303 00

    The image count

    How many images follow: three in this file. The field is 16 bits, so in theory up to 65,535.

  4. 410 10 00 00 01 00 20 00 68 04 00 00 36 00 00 00

    A 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. 520 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. 628 00 00 00 10 00 00 00 20 00 00 00

    The 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. 7ff 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. 800 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. 9image 2, image 3

    The other images

    Each starts at the offset its directory entry gave. A PNG image would start with 89 50 4E 47 instead 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) imagePNG image
Starts withA 40-byte BITMAPINFOHEADER (28 00 00 00)The PNG signature (89 50 4E 47 …)
CompressionNonePNG's lossless compression
TransparencyA 1-bit AND mask, plus an alpha channel in 32-bit imagesPNG's own alpha channel
Supported byWindows 3.0 onwards and virtually every ICO readerWindows Vista and later, browsers and most current tools
Typical useSizes up to 48 or 64 pixels256 × 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:

index.html
<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 what sample-favicon.ico contains.
  • 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

ICOPNGSVG
Sizes per fileSeveralOneAny: it's vector
Windows program and shortcut iconsYes, the native formatNoNo
Browser tab iconYes, everywhereYesYes, in most current browsers
Hand-tuned small sizesYes, one image per sizeOne file per sizeNo, one drawing scaled
Can follow dark modeNoNoYes, with a CSS media query inside
Edit withIcon editors, GIMPAny image editorVector 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.ico on 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.ico writes all three sizes into one file. In GIMP, put each size on its own layer and export as .ico. In Python, Pillow's save("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.png writes frame-0.png, frame-1.png and so on, one per image.
  • Use it on Windows: right-click a shortcut or folder, choose Properties, then Change Icon, and browse to the .ico file.

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.

sample-favicon.ico · 14.7 KBDownloadOpen
The sample file sample-favicon.ico

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.

  1. Header

    The signature 00 00 01 00 and an image count of 3.

  2. Directory

    Three 16-byte entries: 16 × 16, 32 × 32 and 48 × 48, all 32 bits per pixel, with their byte sizes and offsets.

  3. 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.

  4. 32 × 32, green

    Same structure, 4,264 bytes. This is the image a browser uses for the tab on a high-resolution screen.

  5. 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.ico as 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.ico checks PNG images and the 0-means-256 rule; sample-4bit.ico checks palettes and the AND mask.
  • Converters: convert sample-app-icon.ico to 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-icon or image/vnd.microsoft.icon type, others the 00 00 01 00 signature. 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

Last reviewed 27 October 2026.