What is an SVG favicon?
An SVG favicon is a vector-based icon that scales perfectly at any size. Unlike PNG or ICO favicons, SVG favicons never get blurry — they're rendered at the exact resolution needed.
Why use SVG favicons?
Perfect scaling
- Any size, any resolution — No more creating multiple PNG sizes
- High-DPI ready — Always sharp on Retina and 4K displays
- Future-proof — Works on any screen density, present and future
Dark mode support
SVG favicons can adapt to the user's color scheme using CSS media queries:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
path { fill: #333; }
@media (prefers-color-scheme: dark) {
path { fill: #fff; }
}
</style>
<path d="M16 2L2 30h28L16 2z" />
</svg>Small file size
SVGs are typically much smaller than equivalent PNGs, especially at larger sizes.
Browser support
| Browser | SVG Favicon Support |
|---|---|
| Chrome | Yes (80+) |
| Firefox | Yes (41+) |
| Edge | Yes (80+) |
| Safari | Yes (15.4+) |
| Opera | Yes (67+) |
How to fix it
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />Best practices
- Always provide a PNG fallback — For older browsers that don't support SVG favicons
- Keep it simple — Complex SVGs may not render well at 16x16
- Use CSS for dark mode — Take advantage of SVG's media query support
- Optimize the SVG — Remove unnecessary metadata and whitespace
- Test across browsers — Verify it renders correctly in all major browsers
Recommended setup
<!-- SVG primary (modern browsers) -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<!-- PNG fallback (older browsers) -->
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />