How to make a favicon from an SVG
Updated
One SVG logo can supply every icon a website needs — but browsers, iOS, Android and Windows each ask for something different. This is the minimal modern set, why each file is there, and the tags that tie them together.
The minimal modern set
- favicon.ico — 16, 32 and 48 px in one file, for older browsers and everything that requests /favicon.ico directly (RSS readers, crawlers, some apps).
- favicon.svg — one scalable icon for current browsers; it can even switch colours in dark mode.
- apple-touch-icon.png — 180 × 180, used when someone adds the site to an iPhone or iPad home screen.
- icon-192.png and icon-512.png — referenced from the web app manifest for Android and installed web apps.
- icon-maskable-512.png — the same icon with extra padding, for Android's circle and squircle masks.
- site.webmanifest — the app's name, colours and icon list.
The tags
<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">
<meta name="theme-color" content="#ffffff">sizes="32x32" on the .ico link stops Chrome from preferring the .ico over the SVG. Put the files at the site root so /favicon.ico resolves even for clients that never read the HTML.
Make small sizes readable
At 16 px there are 256 pixels to work with. Fine lines and small text disappear, so a favicon is usually a simplified mark — the symbol without the wordmark, a single letter, a bold shape. Render each size from the vector at that exact size rather than shrinking a large PNG, and check the 16 px version magnified before you ship it.
Backgrounds and padding
- Browser tab icons can be transparent: they sit on the tab's own colour.
- The Apple touch icon should have a solid background — iOS fills transparent areas with black.
- Maskable icons need their important content inside the safe zone — a centred circle 80% of the icon's width — with a solid background to the edges, because Android may crop the icon to a circle. A square logo fits that circle when padded by about 22% on each side.
Dark mode with the SVG favicon
An SVG favicon can carry a media query, so a dark logo turns light on dark browser themes:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
path { fill: #0f172a; }
@media (prefers-color-scheme: dark) { path { fill: #f8fafc; } }
</style>
<path d="M4 4h24v24H4z" />
</svg>