Favicon Party
Back to Reference

SVG Favicons Guide

Scalable Vector Graphics (SVG) are the modern standard for web icons. Unlike static PNG images, a single SVG icon can scale infinitely without pixelation and adapt dynamically to the user's operating system colour scheme.

Implementing Light and Dark Modes

By embedding CSS media queries directly inside your SVG file, you can change the fill colours or paths depending on whether the user's system is in light or dark mode. This prevents dark logos from disappearing on dark browser tabs.

Here is a complete template for a theme-aware SVG favicon:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
    <style>
        /* Default styling for light mode */
        .icon-shape {
            fill: #1a1a1a;
        }
        
        /* Styling overrides for dark mode */
        @media (prefers-color-scheme: dark) {
            .icon-shape {
                fill: #f5f5f5;
            }
        }
    </style>
    <circle cx="50" cy="50" r="40" class="icon-shape" />
</svg>

Read more about the Docs specification and browser support on MDN.

Interactive SVG Validator & Previewer

Use the utility below to test your own SVG file. Simply select or drag in an SVG file, and we will analyse its structure client-side (without uploading it to our server) to verify that it is ready for dark mode, and show you side-by-side previews.

Drag and drop your SVG here, or click to browse

Supports files up to 500 KB