SpunkArt
Color, art and images

Which favicon files and sizes a website needs

A favicon is the small icon that appears in browser tabs, bookmarks and home-screen shortcuts. A short set of files covers every common case, and you can make all of them from one square master image.

The short list

You do not need dozens of sizes. A small, current set looks like this:

FileSizeUsed by
favicon.icoContains 16×16, 32×32 and often 48×48Older browsers and tools that request /favicon.ico automatically
favicon.svgScalableModern browser tabs, sharp at any zoom
apple-touch-icon.png180×180iPhone and iPad home-screen shortcuts
icon-192.png, icon-512.png192×192 and 512×512Android home screens and installable web apps, through a web app manifest

The last row matters only if you add a web app manifest. A plain content site can stop after the first three.

The HTML

Put these lines in the <head> of every page. This site uses the first three.

<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/manifest.webmanifest">

The sizes="any" on the ICO line stops some browsers from preferring the ICO over the SVG. Browsers that understand SVG icons use it; others fall back to the ICO.

What an ICO file is

ICO is a container. One .ico file holds several small images at different sizes, and the system picks the closest. Uncompressed, a 32-bit image takes 4 bytes per pixel, so the three common sizes hold 1,024 + 4,096 + 9,216 = 14,336 bytes of pixel data. Modern ICO files can store each size as a PNG inside, which is usually much smaller.

Designing for 16 pixels

At 16×16 a favicon has 256 pixels in total. Detail disappears. Design for that size first:

  • Use one bold shape or one letter, not a full logo with a slogan.
  • Use strong contrast. The icon must work on a light tab bar and a dark one.
  • Fill most of the square. Thin margins waste the few pixels you have.
  • Check it at actual size, not zoomed in.
  • For the smallest sizes, consider a hand-tuned version where lines land exactly on whole pixels. The pixel art guide covers the technique.

Making the files

  1. Draw a square master, ideally as SVG, or as a PNG of at least 512×512.
  2. Export the 180, 192 and 512 PNG versions. Give the Apple icon a solid background, because transparent areas may be filled with black or white.
  3. Export 16, 32 and 48 PNGs, then combine them into one ICO. ImageMagick does this in one line: magick icon-16.png icon-32.png icon-48.png favicon.ico.
  4. Save the SVG version as favicon.svg. It can even switch colors for dark mode with a @media (prefers-color-scheme: dark) rule inside its own <style>.
  5. Upload all files to the site root and add the HTML tags.

Testing

  • Open each file directly in the browser, for example /favicon.ico, to check it is served and not a 404.
  • Browsers cache favicons hard. Test in a private window, or add a version query such as /favicon.svg?v=2 after a change.
  • Add the site to a phone home screen to check the touch icon.

Common mistakes

  • A PNG renamed to .ico. Some browsers accept it; others do not. Make a real ICO.
  • Relative paths. href="favicon.ico" breaks on pages in sub-folders. Start paths with a slash.
  • Shrinking a detailed logo. It turns into a blur. Simplify instead.

Questions people ask

Does a favicon help search rankings?

It is not a ranking factor as far as is publicly documented. Search results can show it next to your site name, so a clear icon can make your listing easier to recognise.

Can I make a favicon from just a letter or an emoji?

Yes. The text favicon guide shows how to do it with a few lines of SVG.