The Right way to use/make a favicon

Getting a proper favicon on every browser and device today takes two things: the <link> tags in your HTML head and a small set of icon files. Here is the minimal modern setup, replacing the XHTML-vs-HTML snippet this post carried in 2008.

The 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">

Notes: rel="shortcut icon" is a legacy Internet Explorer-ism — plain rel="icon" is correct and all modern browsers understand it. The SVG icon scales crisply everywhere that supports it (all evergreen browsers), and the ICO remains the fallback for older tooling. Self-closing the tag with /> is only valid XHTML; in plain HTML just use >.

The files

  • /favicon.ico — 32×32 (or a multi-size 16/32/48 ICO). Browsers request this path automatically even with no link tag.
  • /icon.svg — a square SVG, ideally matching your dark/light theme via a media query inside the file.
  • /apple-touch-icon.png — 180×180 PNG for iOS home-screen bookmarks; Apple ignores the smaller ICO.

Making one

The quickest route is RealFaviconGenerator: upload one square image, get the full file set plus the matching head tags. Command line, with ImageMagick:

magick icon.png -define icon:auto-resize=16,32,48 favicon.ico

And if you want the Photoshop route, the old PhotoshopSupport favicon tutorial linked here in 2008 is, remarkably, still online.

Leave a Reply

Your email address will not be published. Required fields are marked *