SVG Favicon: Modern Vector Favicons for Any Screen
SVG favicon with dark mode: copy-paste SVG and link tags with an ICO fallback, Chrome 157 link order tested, browser and Google Search support, failure table, file sizes.
On this page ⌄
An SVG favicon is one small file that stays sharp at every size and can switch colours for dark mode. Yes, an SVG can be a favicon: Chrome, Edge, Firefox, Opera and Safari 26 and later accept it in a <link rel="icon" type="image/svg+xml"> tag. The short answer for markup is to put the ICO first with sizes="48x48" and the SVG second with sizes="any"; with the 16, 32 and 48 px ICO the Favicon Generator writes, that is the order that stored the SVG in Chrome 157 in every run. It is easy to get wrong in five places: the MIME type, the order and sizes of the <link> tags, text that depends on fonts, expecting dark mode to follow your site's theme toggle, and forgetting that Google Search does not list SVG among its favicon formats. The browser tests below were run in Chrome 157 by asking Chrome which favicon it stored for each test page through chrome://favicon2, so the results are what the browser chose, not just which files it requested. That page is Chrome's favicon service, not a screenshot of the tab strip. Firefox and Safari were not run, and claims about them come from the cited sources. The Favicon Generator makes the PNG sizes and a favicon.ico (16, 32 and 48 px) from an uploaded image; its letter and emoji mode can also write a favicon.svg and a full icon pack, but the SVG below is written by hand and was not made with it.
Copy-paste SVG with dark mode
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
rect { fill: #18181b; }
path { stroke: #f4f4f5; }
@media (prefers-color-scheme: dark) {
rect { fill: #f4f4f5; }
path { stroke: #18181b; }
}
</style>
<rect width="32" height="32" rx="6"/>
<path d="M10 10l12 12M22 10L10 22" fill="none" stroke-width="4" stroke-linecap="round"/>
</svg>
It is a rounded square with an X drawn as a stroked path. A path, not a <text> element, is deliberate (see the failure table). The file is 387 bytes.
The markup
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" href="/favicon.svg" type="image/svg+xml" sizes="any">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
Order and sizes both matter. MDN says that with several <link rel="icon"> tags the browser uses their media, type and sizes attributes to pick the most appropriate one, and that if several are equally appropriate the last one is used. Thirteen markup variants were loaded in Chrome 157, three times each, every run in a fresh profile. The ICO was the one this site's Favicon Generator produces: three PNG frames, 16, 32 and 48 px (1,237 bytes, built with the same buildIco code). The SVG was red and the ICO blue so the stored favicon could be told apart by colour, and the readout was taken at chrome://favicon2 sizes 16, 32 and 64 (all three sizes agreed in every run). The "requested" column is what the server saw on that first load:
| markup (in order) | favicon Chrome stored, 3 of 3 runs | files requested |
|---|---|---|
| SVG only | SVG | svg |
SVG with no type attribute only | SVG | svg |
| ICO only | ICO | ico |
ICO sizes="48x48", then SVG | SVG | svg |
ICO sizes="32x32", then SVG | SVG | svg |
ICO sizes="48x48", then SVG sizes="any" | SVG | svg |
ICO with no sizes, then SVG | ICO | svg, then ico |
ICO sizes="any", then SVG | ICO | svg, then ico |
ICO sizes="any", then SVG sizes="any" | ICO | svg, then ico |
SVG, then ICO sizes="32x32" | SVG | svg |
SVG sizes="any", then ICO sizes="48x48" | SVG | svg |
SVG, then ICO with no sizes | ICO | ico |
SVG, then ICO sizes="any" | ICO | ico |
So give the ICO an explicit size, sizes="48x48", and list it before the SVG. An ICO with sizes="any" or no sizes beat the SVG in either position with this ICO, which is one reason people report that their SVG favicon "does not work". This is consistent with the MDN rule, but the test does not prove why. Space Jelly uses the same pattern (sizes="48x48" on the ICO, sizes="any" on the SVG) and says that without the sizes attribute Chrome finds the ICO and uses that; it also says Safari uses the ICO. Safari was not run here. The type attribute is optional in Chrome 157: <link rel="icon" href="/favicon.svg"> with the correct MIME type stored the SVG.
The result depends on the ICO's frames, so test your own ICO before trusting a copied snippet.
Single-frame ICOs were also run, one run each, on six of the arrangements above. With an ICO holding only a 16, 48 or 256 px image, the SVG was stored in five of them (ICO 48x48 then SVG, ICO with no sizes then SVG, ICO sizes="any" then SVG, SVG then ICO 32x32, SVG then ICO sizes="any"), and the ICO was stored only in the sixth, ICO only. With a 32 px-only ICO the ICO won only when the SVG was listed first and the ICO had no sizes or sizes="any". So the 16, 32, 48 px ICO that tools produce is the case where an unsized ICO beats the SVG even when listed first, and sizes="48x48" on the ICO listed first stored the SVG with every ICO tried.
SVG or ICO?
Use both. The SVG covers current browser tabs and can adapt to dark mode. The ICO (or a PNG) covers older browsers and Safari before 26, and it is the format Google Search lists. Declare the ICO with an explicit size and before the SVG, as in the table above. Google's favicon guidelines say "Google Search supports the following favicon file formats: BMP, GIF, ICO, PNG, JPEG, PPM, and TIFF", which does not include SVG, that the favicon must be a square of at least 8x8 px, that a favicon larger than 48x48 px is recommended, and that Google Search supports one favicon per site (a site is defined by the hostname). An SVG-only setup can look right in the tab and still leave Google Search without a usable icon. To make an ICO from a PNG or other image, the Favicon Generator's upload tab has a favicon.ico download.
Browser support
From the caniuse "SVG favicons" data (link-icon-svg, read from the project's GitHub repository on 2026-11-19), the first version with full support:
| Browser | First version |
|---|---|
| Chrome | 80 |
| Edge | 80 |
| Firefox | 41 (versions 4 to 40 partial: the SVG loaded only on the first page load, not on later loads) |
| Opera | 44 |
| Safari | 26.0 |
| iOS Safari | 26.0 |
| Chrome for Android | 157 (the current version in the data) |
The same data gives global usage with full support as 92.55%. Notes in the data: support requires the served MIME type to be image/svg+xml, and Chromium browsers serve the SVG in a secure static mode but apply SMIL animations using the document start time. Wikipedia's Favicon article lists the same start versions for Firefox (41) and Chromium-based browsers (80) and says Internet Explorer does not support SVG favicons. Safari before 26 is not in the full-support column, so older Safari versions need the ICO or PNG fallback, which is why the ICO line stays.
Dark mode: it follows the browser, not your site
The @media (prefers-color-scheme: dark) block inside the SVG is what makes a favicon adapt. Space Jelly describes it as following the visitor's system preference, not a site-level toggle, and says to refresh the page after changing the system appearance so the new favicon version loads. In Chrome 157 the same red SVG (green inside prefers-color-scheme: dark) was loaded as a favicon in a fresh profile, five runs per setting, and the stored favicon at chrome://favicon2 size 32 was:
| setting | page's own prefers-color-scheme | stored favicon, 5 runs |
|---|---|---|
| default | light | red (5 of 5) |
colorScheme: 'dark' (Playwright context option) | dark | red (5 of 5) |
--blink-settings=preferredColorScheme=1 | light | red (5 of 5) |
--force-dark-mode | light | green (5 of 5) |
--force-dark-mode and colorScheme: 'dark' | dark | green (5 of 5) |
So page-level dark mode does not reach the favicon, while the browser-level --force-dark-mode switch does, even though the page itself still reports light. As an <img> on a page, the same SVG turned green under colorScheme: 'dark' and under DevTools protocol media emulation, and stayed red under --force-dark-mode and --blink-settings=preferredColorScheme=1. A real operating system dark theme was not tested: the Windows theme was not switched.
In practice, plan for the favicon following the browser or operating system theme, so a site-level theme toggle cannot change it. An earlier version of this guide reported the --force-dark-mode result for Chrome 156; it holds in 157. Safari is a known gap: WebKit bug 309949, reported on 2026-03-13 against Safari 26.3 and still marked NEW when read on 2026-11-19, says SVG favicons there do not respond to media query overrides such as dark mode, while Firefox and Chromium update when the theme changes. Pick colours that read on both tab backgrounds. A white icon fails on a light tab and a black icon fails on a dark one, which is why the example swaps fill and stroke.
Failure table
| symptom | cause | what was observed |
|---|---|---|
| Generic globe icon | wrong MIME type | SVG served as text/plain or text/html: Chrome 157 stored its default icon |
| Generic globe icon | no xmlns on the root <svg> | Chrome 157 stored its default icon |
| Favicon not updating | cached copy | the cache is a separate store; see Favicon Not Updating |
| Dark mode ignored | favicon follows the browser theme, not the page | page-level dark mode left the stored icon red; --force-dark-mode made it green |
| Letter looks different on other machines | <text> depends on installed fonts | glyph bounds changed with the font family (below) |
| Blurry or clipped at 16px | detail too fine | simplify the shape; see below for viewBox |
| SVG ignored and ICO used | ICO declared with sizes="any" or no sizes | with the 16, 32, 48 ICO, either order gave the ICO; sizes="48x48" on the ICO first gave the SVG |
| Search results show no icon | SVG is not in Google's list of favicon formats | link an ICO or PNG as well |
Text must be converted to paths
The same text was drawn with three font families and the bounding box of the white pixels was measured. Setup: <svg viewBox="0 0 32 32"><rect width="32" height="32" fill="#000"/><text x="16" y="24" font-size="22" text-anchor="middle" fill="#fff" font-family="FONT">X</text></svg> as a base64 data URI in <img width="64" height="64">, a screenshot of that 64 x 64 area, and every pixel with grey value above 128 counted as white. Georgia gave x 17 to 47, y 18 to 47; Courier New x 21 to 43, y 23 to 47; an unknown font name (NoSuchFontXyz, sans-serif) x 18 to 45, y 16 to 47. The letter changes shape and position with the font that happens to be installed. These numbers are for one Windows machine's fonts. Convert text to outlines in your vector editor, or draw the glyph as a path as above.
viewBox
Keep viewBox="0 0 32 32". The check used this shape: <rect width="32" height="32" rx="6" fill="#d00000"/> plus a white X path, once with the viewBox, once with neither viewBox nor width and height, and once with width="32" height="32" only. Red pixels were counted in the chrome://favicon2 readout. At size 32 all three gave 818 and at size 64 all three gave 3,272. At size 16 the version without viewBox or width and height gave 212 against 204 for the other two. Drawn as a plain <img> of 16 and 32 CSS px, the version with a viewBox and the one without had 206 and 205 red pixels at 16 and 818 each at 32. So Chrome 157 forgives a missing viewBox for this shape. Not tested: Firefox, Safari, and shapes that do not start at the origin.
File sizes: SVG vs PNG vs ICO
The lettermark above rendered at each size with sharp 0.34.5, as PNG:
| file | bytes |
|---|---|
favicon.svg | 387 |
| PNG 16x16 | 256 |
| PNG 32x32 | 415 |
| PNG 48x48 | 561 |
| ICO with the 16, 32 and 48 PNGs | 1,286 (6-byte header, three 16-byte directory entries, plus the three PNGs) |
| PNG 180x180 (apple-touch-icon) | 2,971 |
| PNG 192x192 | 3,074 |
| PNG 512x512 | 12,924 |
A flat shape like this makes the SVG about the size of the 32px PNG. A detailed logo will not: size depends on the artwork, so these numbers are for this icon only. MDN notes that iOS does not use rel="icon" and uses the non-standard apple-touch-icon instead, so the 180 pixel PNG is still needed for the iPhone home screen.
Animated favicons
Animated favicons, JavaScript favicon swapping and per-environment coloured favicons were not tested. If you add them, remember that Chromium applies SMIL animation from the document start time, per the caniuse note, so an animated favicon will not start from the beginning when the tab loads.
Tested
2026-11-19, Chrome 157.0.8103.78 via playwright-core (launchPersistentContext, headless, a fresh profile for every run) on Windows 11 with a light system theme, Node v26.13.1, sharp 0.34.5, Pillow 12.3.0. The stored favicon was read from chrome://favicon2/ after loading each test page from a local server; the readout is Chrome's favicon service, not a screenshot of the tab strip. The link-order matrix used a 16, 32, 48 px ICO built with the Favicon Generator's buildIco code, 13 markup variants, 3 runs each, with all three readout sizes agreeing. Single-frame ICOs (16, 32, 48 and 256 px, built with the same code) were run on six arrangements, one run each. The dark-mode table is 5 runs per setting in fresh profiles. Not tested: Firefox, Safari (any version), Edge, mobile browsers, a real operating system dark theme, SVG upload in the Favicon Generator, animated SVG favicons, and any favicon displayed in a bookmarks bar or search results.
Sources
- Can I use: SVG favicons: per-browser first versions, MIME type and SMIL notes (read from the Fyrd/caniuse
features-json/link-icon-svg.jsonfile). - MDN: rel attribute values: how the browser chooses among several icon links; iOS and
apple-touch-icon. - Google Search Central: favicon guidelines: supported formats, minimum size, one favicon per hostname.
- Wikipedia: Favicon: SVG favicon support by browser and dark mode adaptation.
- Space Jelly: Light & Dark Mode Favicons:
prefers-color-schemeinside the SVG, system preference, thesizes="48x48"quirk. - WebKit Bugzilla 309949: SVG favicons ignoring media query overrides in Safari 26.3.
Keep reading
Related tools
Favicon Generator
Generate favicon package from any image or emoji. Multiple sizes (16, 32, 48, 180, 192, 512), favicon.ico, SVG, site.webmanifest and an HTML snippet.
WebP to JPG Converter
Convert WebP to JPG, PNG or WebP in your browser. Batch files, set quality, pick a background for transparency. Nothing is uploaded.
Image Compressor
Compress JPEG, PNG, and WebP images in your browser. Adjustable quality, batch mode. Files never leave your device.
Color Picker
Pick colors, convert hex/RGB/HSL/OKLCH, and check WCAG contrast.
Written by Mian Ali Khalid. More guides in Frontend & Design.