JA EN

Complete Favicon Creation Guide - ICO, SVG, and PNG Explained

· About 9 min read

What Is a Favicon - Purpose and Importance

A favicon ("favorite icon") is a small icon image that identifies a website. It appears in browser tabs, bookmarks, history, search results (Google mobile search), and various other locations.

Why favicons matter:

Favicon history dates back to Internet Explorer 5 in 1999. Originally, placing a 16x16px ICO file at /favicon.ico sufficed. Today, requirements include high-resolution displays, dark mode, and PWA support, making multiple formats and sizes standard practice.

Favicon Format Comparison - ICO, SVG, PNG

Modern favicon implementation combines three formats. Understanding each format's characteristics and use cases is essential.

ICO (Windows Icon Format):

SVG (Scalable Vector Graphics):

PNG (Portable Network Graphics):

The 2026 recommended setup is a three-layer structure with SVG as primary, ICO as fallback, and PNG for Apple/Android.

Minimal and Recommended Configurations

Favicon implementation can scale from minimal to comprehensive based on project requirements.

Minimal configuration (3 files):

These 3 files cover major browsers and devices:

  1. /favicon.ico - 32x32px (legacy browsers, no <link> tag needed)
  2. /favicon.svg - SVG (modern browsers, dark mode capable)
  3. /apple-touch-icon.png - 180x180px (iOS)

HTML markup:

<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">

Recommended configuration (including PWA):

Add the following to the minimal setup:

The manifest file includes icon information like "icons": [{"src": "/icon-192.png", "sizes": "192x192", "type": "image/png"}, {"src": "/icon-512.png", "sizes": "512x512", "type": "image/png"}]. Reference it from HTML with <link rel="manifest" href="/manifest.webmanifest">.

Dark Mode Support with SVG Favicons

One of SVG favicon's greatest advantages is the ability to automatically switch icon colors based on OS dark mode settings by embedding CSS media queries within the SVG.

Implementation example:

Place a <style> element inside the SVG file and use @media (prefers-color-scheme: dark) to switch colors:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
path { fill: #1a1a2e; }
@media (prefers-color-scheme: dark) {
path { fill: #e0e0e0; }
}
</style>
<path d="M4 4h24v24H4z"/>
</svg>

Design considerations:

Testing method:

Use Chrome DevTools' "Rendering" panel to emulate prefers-color-scheme and verify both modes. On macOS, switch via "System Settings → Appearance"; on Windows, via "Settings → Personalization → Colors". Always verify actual appearance in browser tabs - SVG previews alone cannot judge visibility at actual tab display size (16x16px).

Favicon Design Best Practices

Since favicons display at an extremely small 16x16px, they require a different approach than standard logo design.

Design principles:

Common failure patterns:

Production workflow:

  1. Start designing on a 32x32px canvas (2x of 16px for easier work)
  2. Verify visibility when reduced to 16x16px
  3. Create SVG vector version (include dark mode CSS)
  4. Export 16x16 and 32x32 bitmaps for ICO
  5. Export 180x180px PNG for Apple Touch Icon (rounded corners are auto-applied by iOS)

Favicon Generation Tools and Implementation Automation

Manually creating each favicon format and size is tedious, so leveraging auto-generation tools is efficient.

Online tools:

Command-line tools:

Build pipeline integration:

Frameworks like Next.js, Nuxt, and Astro automatically serve favicon files placed in the public/ directory. Incorporating a build script that auto-generates PNGs at various sizes from SVG means managing only a single SVG source file.

Verification methods:

Related Articles

SVG Fundamentals and Practical Usage - From Vector Basics to Animation

Complete guide to SVG from basic structure to practical applications. Learn paths, shapes, text, filters, animation implementation, and optimization techniques for web development.

Responsive Images Implementation Guide - Complete Guide to srcset, sizes, and picture Elements

Learn how to serve optimal images based on device screen size and resolution with detailed code examples for responsive image implementation.

Dark Mode Image Implementation Guide - Switching with picture Element and CSS

Learn how to implement dark mode-optimized images. Covers picture element media attributes, CSS prefers-color-scheme, SVG color inversion, and other practical techniques.

Vector vs Raster - A Guide to Choosing the Right Image Format

Understand the differences between vector and raster images from their underlying mechanics. Learn which format to choose for logos, photos, web design, and more.

CSS Sprites Guide - Creating and Optimizing Image Sprite Sheets

Learn how to create CSS sprites, optimize sprite sheets, and reduce HTTP requests. A practical guide to improving page load performance with image sprites.

Transparent Image Guide - Creating and Using Transparent Backgrounds with PNG, WebP, and SVG

Learn how to create transparent images essential for web design, with format-specific techniques for PNG, WebP, and SVG transparency.

Related Terms