---
title: "How do I add a favicon that works everywhere in 2026?"
description: "A small set of files covers every browser and device: an SVG favicon, a favicon.ico fallback, an apple-touch-icon and a web app manifest. Here is the exact markup and sizes."
url: https://www.danny.engineering/answer/html/how-do-i-add-a-favicon-that-works-everywhere-in-2026
author: Danny
published: 2026-11-27T00:00:00.000Z
updated: 2026-11-27T17:24:00.000Z
tags: ["HTML"]
---

# How do I add a favicon that works everywhere in 2026?

## The short answer


You do not need dozens of icon sizes. An SVG favicon, a `favicon.ico` fallback, a 180 by 180 pixel `apple-touch-icon` and a web app manifest with 192 and 512 pixel PNGs cover current browsers, home screens and installed apps.


```html
<link rel="icon" href="/favicon.ico" sizes="32x32" />
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.webmanifest" />
```


## Why it happens


Different parts of the platform look for icons in different places:

- **Browser tabs and bookmarks** read `link rel="icon"`. If there is none, most browsers request `/favicon.ico` from the site root.
- **iOS and iPadOS home screens** use `apple-touch-icon`. They ignore the manifest icons for this.
- **Android home screens and installed web apps** read the icons listed in the web app manifest.

Old advice listed every size each device once used. Today browsers scale icons well, SVG favicons are supported in Chromium browsers, Firefox and, since Safari 26, Safari as well. The ICO file stays as a safety net for older browsers and tools that only ever request `/favicon.ico`.


## How to fix it


### Create the files


Put these in the root of your public folder:


| File                   | Size       | Used by                                  |
| ---------------------- | ---------- | ---------------------------------------- |
| `favicon.ico`          | 32 by 32   | Older browsers, RSS readers, other tools |
| `icon.svg`             | Any        | Modern browser tabs                      |
| `apple-touch-icon.png` | 180 by 180 | iOS and iPadOS home screen               |
| `icon-192.png`         | 192 by 192 | Android home screen                      |
| `icon-512.png`         | 512 by 512 | Android splash screen, install prompts   |


Give the Apple icon a solid background and some padding. iOS fills transparent areas with black and rounds the corners itself.


### Add the link tags


Put the `link` tags from the short answer in the `head` of every page. The `sizes="32x32"` on the ICO line stops Chromium choosing the ICO over the SVG.


### Write the manifest


```json
{
  "name": "My Site",
  "short_name": "My Site",
  "icons": [
    { "src": "/icon-192.png", "type": "image/png", "sizes": "192x192" },
    { "src": "/icon-512.png", "type": "image/png", "sizes": "512x512" },
    {
      "src": "/icon-mask.png",
      "type": "image/png",
      "sizes": "512x512",
      "purpose": "maskable"
    }
  ],
  "theme_color": "#ffffff",
  "background_color": "#ffffff",
  "display": "standalone"
}
```


The maskable icon is optional. Android crops it into a circle or rounded shape, so keep the logo inside the central 80 percent.


### Support dark mode in the SVG


Because the SVG is a real document, it can carry its own media query. That lets a dark logo switch to a light one when the browser uses a dark theme.


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


Support for the media query inside favicons varies, so pick colours that are still readable on both light and dark tab bars.


### Using a framework


In the Next.js App Router you can drop `favicon.ico`, `icon.svg` and `apple-icon.png` into the `app` folder and it writes the tags for you. Other frameworks usually just serve files from a `public` folder, so the markup above works as is.


## Common pitfalls

- Seeing the old icon after a change. Browsers cache favicons hard. Rename the file or add a query string such as `icon.svg?v=2` and do a hard reload.
- Forgetting the ICO at the root. Some tools never read your `link` tags.
- Using a transparent PNG for `apple-touch-icon`, which ends up on a black square.
- Pointing to icons with relative paths like `icons/icon.svg`. On nested pages they resolve to the wrong place; start them with a slash.
- Detailed logos at 16 pixels. Simplify the mark for the favicon rather than shrinking the full logo.

## Related reading

- [MDN: link types, icon](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel#icon)
- [MDN: web app manifest icons](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/icons)
