Why inline SVG favicons beat .ico
| Inline SVG Data URI | Traditional .ico | |
|---|---|---|
| Files to manage | Zero — inline in HTML | At least 1, often 3–6 sizes |
| Resolution | Vector — crisp at any size | Raster — blurs when scaled |
| Dark mode | Built-in via CSS media query | Requires separate file |
| HTTP requests | Zero — rides in the HTML | 1+ per file |
| Size (typical logo) | 200–800 bytes | 1–5 KB for multi-size .ico |
An inline SVG favicon as a data URI adds a few hundred bytes to your HTML — less than a single line of JavaScript. In return, you eliminate every favicon file from your asset pipeline and get dark mode for free.
Browser support
| Browser | Version | Support |
|---|---|---|
| Chrome | 80+ | Full |
| Edge | 80+ | Full |
| Firefox | 41+ | Full |
| Safari | 26+ | Full |
| Safari iOS | 26+ | Full |
| Samsung Internet | 13+ | Full |
| IE 11 | — | None (falls back to .ico) |
Combined support is ~93% of global users. For the remaining ~7%, a .ico fallback handles it automatically.
Dark mode favicon
Add a <style> block with a prefers-color-scheme media query inside your SVG before encoding. The favicon adapts to the user's OS theme with zero JavaScript:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<style>
.bg { fill: white }
.fg { fill: black }
@media (prefers-color-scheme: dark) {
.bg { fill: black }
.fg { fill: white }
}
</style>
<rect class="bg" width="100" height="100" rx="20"/>
<circle class="fg" cx="50" cy="50" r="30"/>
</svg>Paste this SVG into the encoder above, copy the output, and drop it in your <head>. The favicon renders light-on-dark or dark-on-light depending on the user's OS setting — automatically, without JavaScript.
Production setup with legacy fallback
Modern browsers pick the last supported rel="icon" link. Put an .ico first, then the inline SVG data URI — browsers that understand SVG favicons use it; IE11 and old Safari fall back to the ICO:
<link rel="icon" href="/favicon.ico" sizes="32x32"> <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='50' fill='%232563eb'/%3E%3C/svg%3E">
Use the encoder above to generate the inline SVG data URI, then paste it into the second <link> tag. The .ico above it ensures older browsers still get a favicon.
Need more detail? Read the full guide: SVG Favicon in 2026 — Inline with a Data URI. Or try the main SVG Encoder for all 7 output formats (CSS, HTML, JSX, mask, object, and more).