Skip to main content
Faviqo

Guides · Updated 2026-12-04

How to add a favicon to your website

A favicon is the small icon that appears in browser tabs, bookmarks, history lists and, increasingly, in search results and on phone home screens. Adding one takes about ten minutes, but the details trip people up: the wrong file name, a missing link tag, a path that works locally and breaks in production, or a stale cached copy that makes the change look like it failed.

This guide walks through the whole job in order. You will decide which files you need, create them from a single source image, place them correctly, add the HTML, and then verify the result. It works for a hand-written site, a framework project, or a site builder that lets you edit the head.

Step 1: decide which files you actually need

Older tutorials ask for a dozen files in sizes from 16 to 310 pixels. Most of those targets are obsolete. A modern, reliable set is small, and each file has one job.

The first is favicon.ico, a legacy container that holds several sizes in one file. Browsers still request /favicon.ico from the site root by default, and many tools, feed readers and older browsers depend on it. The second is a PNG or SVG icon for current browsers, which is sharper than the ICO on high-density screens. The third is an Apple touch icon at 180 by 180 pixels, used when someone adds your site to an iPhone or iPad home screen. The last pair is a 192 by 192 and a 512 by 512 PNG, referenced from a web app manifest, which Android and Chrome use for install prompts and launchers.

  • favicon.ico: 16, 32 and 48 pixel images in one file, served from the site root.
  • icon.svg or icon-32.png: the sharp icon for modern browsers.
  • apple-touch-icon.png: 180 by 180 pixels, with no transparency.
  • icon-192.png and icon-512.png: referenced from site.webmanifest.

Step 2: start from one good source image

Every file above should come from the same source, so the icon looks identical everywhere. Use a square image, at least 512 by 512 pixels, and ideally a vector such as SVG. A square source avoids the stretching that happens when a wide logo is squeezed into a square frame.

Do not use your full logo unless it is already a simple mark. A tab icon is displayed at 16 by 16 or 32 by 32 pixels, which is smaller than most people expect. Fine lines, taglines and small text turn into a blur at that size. Use the symbol, a single letter, or a simplified version of the mark, and give it some contrast against both light and dark browser themes.

Faviqo's generator takes one image and produces every file in the set at once, with the HTML and the manifest, entirely in your browser. You can also export each size yourself from a design tool; the result is the same as long as every size starts from the same artwork.

Step 3: put the files in the right place

Place favicon.ico in the root of your site, so it is reachable at https://example.com/favicon.ico. Browsers and crawlers look there even if your HTML does not mention it, and a missing file produces a 404 in your logs on every page view.

The other files can live anywhere, but keeping them in the root, or in one predictable folder, makes the paths easy to reason about. In a framework with a public or static directory, such as Vite, Next.js, Astro or SvelteKit, anything in that folder is copied to the site root as is. In WordPress, the Site Icon setting under Appearance and Customize handles the work for you, and in most site builders there is an equivalent field in the settings.

Step 4: add the HTML to your head

Add these tags inside the head element of every page, or once in the shared layout so they apply everywhere. The order matters less than the correct paths and the sizes attribute on the ICO link.

<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="/site.webmanifest">

Why the ICO link has sizes

Chrome can pick the wrong icon when both an ICO and an SVG are declared without hints. Marking the ICO as sizes 32x32 stops it from choosing the ICO over the SVG on browsers that support SVG favicons. Browsers that do not understand SVG icons fall back to the ICO, which is exactly what you want.

Always use absolute paths that start with a slash. A relative path such as images/icon.png works on the home page and then fails on /blog/post, because the browser resolves it against the current folder.

Step 5: add the manifest

The manifest is a small JSON file that tells Android and Chrome about your icons, name and theme colour. You only need it if you want your site to be installable or to look right when saved to a home screen, but it takes a minute and costs nothing.

{
  "name": "Example",
  "short_name": "Example",
  "icons": [
    { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" }
  ],
  "theme_color": "#ffffff",
  "background_color": "#ffffff",
  "display": "standalone"
}

Step 6: test it properly

Open your site in a private window, so no cached icon interferes, and look at the tab. Then request each file directly, such as /favicon.ico and /apple-touch-icon.png, and confirm that each returns an image with a 200 status, not an HTML error page. A common mistake is a single-page app that serves index.html for every unknown path, so a missing icon quietly returns HTML with a 200 status and the browser shows nothing.

Check the Network tab in your browser's developer tools while reloading, and filter for the file names. If a request is red, the path is wrong. If it is green but the tab shows the old icon, the browser is serving a cached copy; the guide on favicons that do not update covers that case in detail.

Finally, run the page through a checker. Faviqo's favicon checker inspects the file you upload for size, format, contrast and the safe zone, and also reads pasted head markup for missing or contradictory tags.

Common mistakes to avoid

Most failed favicon installs come from a short list of causes. Keeping it in mind saves a lot of debugging.

  • Using a rectangular logo. The icon is displayed in a square, so wide artwork is squashed or cropped.
  • Putting a transparent PNG in the Apple touch icon. iOS fills transparent areas with black, so use a solid background.
  • Declaring only a 16 by 16 PNG. It looks soft on high-density screens, where 32 pixels or an SVG is sharper.
  • Renaming a file without changing its URL, then wondering why browsers show the old icon.
  • Blocking /favicon.ico in robots.txt or behind a login, so crawlers and some browsers never see it.

Was this guide helpful?

Questions

Do I still need favicon.ico?

Yes, it is still worth having. Browsers request /favicon.ico by default, and feed readers, crawlers and older software rely on it. It costs a few kilobytes.

What size should a favicon be?

Make the ICO with 16, 32 and 48 pixel images, a 180 by 180 Apple touch icon, and 192 and 512 pixel PNGs for the manifest. Start from a square image of at least 512 pixels.

Where do I put the favicon file?

In the root of your site, so it loads at /favicon.ico, with the other icons in the same place or one predictable folder. Link to them with absolute paths starting with a slash.

Why is my favicon not showing?

The usual causes are a wrong path, a server returning HTML instead of an image, or a cached copy of the old icon. Test the file URL directly and try a private window.

Try it

More guides