Skip to content

Web Development and Icons

Favicon Not Showing? Work Through These Nine Causes in Order

Nine causes, ordered from most likely to least, with the exact curl command and DevTools steps for each. Written for the version of you that is debugging this at 11pm and has already tried a hard refresh twice.

·Creator of ToolFiddle··16 min read

It is 11pm, the deploy went green forty minutes ago, and sitting in the browser tab where your logo should be is a blank sheet of paper. You have hard-refreshed four times. You have opened an incognito window, which worked, which somehow made it worse because now you cannot reproduce the thing you are trying to fix.

A favicon not showing is a bug with an unusually bad ratio of difficulty to time spent. There are roughly nine distinct causes. All nine produce the exact same symptom, which is nothing where an icon should be, and most guides list them in a random order that makes you check the least likely one first.

So here is the order I would actually use, worst offender to rarest, with the exact command or DevTools step for each. Work down the list. Stop when the icon appears.

One thing before you start. Do not change the file. Almost nobody’s favicon problem is a bad image file, and re-exporting the PNG at a different size is the single most common wasted hour in this whole category of bug. Prove the delivery works first, then look at the pixels.

The short answer

Request the icon URL directly with curl and check two things: a 200 status and a correct Content-Type. If that fails, it is a serving or path problem and no amount of cache clearing will help. If it succeeds, the file is fine and the problem is on the client side, which means the browser cache, a stale /favicon.ico at the root, a Content Security Policy blocking the fetch, or a service worker returning the wrong response.

In practice the ranking looks like this. Browser cache is the most common cause by a wide margin. Wrong path, particularly a relative href on a nested route, is second. A service worker or SPA fallback returning index.html with a 200 for a missing icon is third and the most confusing, because the request appears to succeed. Everything else is a long tail.

The nine checks, in order

Run these top to bottom. Each one takes under a minute, and the order is deliberate: the earlier checks are both more likely to be your problem and cheaper to run.

  1. Request the icon URL directly and confirm a 200 plus the right Content-Type.
  2. Check the href is root-absolute (/favicon.ico), not relative (favicon.ico).
  3. Bust the browser’s favicon cache properly, because a hard reload does not do it.
  4. Look for a stale /favicon.ico at the site root that is winning over your tag.
  5. Read the console for a Content Security Policy block.
  6. Confirm the file is genuinely the format its extension claims.
  7. Check whether a service worker is answering the request.
  8. Check for mixed content, cross-host icons and CDN staleness.
  9. Check your framework’s own favicon conventions, which probably override yours.
Symptom Most likely cause Test to run
Blank icon everywhere, including incognito File not served, or 404 curl -sI https://site.com/favicon.ico
Works in incognito, not in your normal window Browser favicon cache Open the icon URL in a tab, reload
Old icon still showing after deploy Favicon cache or CDN cache Version query string on the href
Works on the home page, blank on /blog/post Relative href Read the rendered HTML on the nested route
Icon URL returns 200 but browser shows nothing Wrong Content-Type, or HTML returned curl -sI and read the header
Works locally, blank in production File missing from build output List the deployed directory
Blank only after a second visit Service worker cache DevTools Application, Service Workers
Console shows a “Refused to load” message CSP img-src Read the directive named in the error
Fine on desktop, blank on iPhone home screen Missing apple-touch-icon View source on mobile, check the tag

Check 1: prove the file is actually being served

Open a terminal. Do not open DevTools yet.

curl -s -o /dev/null -w '%{http_code} %{content_type} %{size_download}\n' \
  https://example.com/favicon.ico

You want something like 200 image/x-icon 15086. Three things can go wrong here and each points somewhere different.

A 404 means the file is not where you think it is. Check the deployed output, not your local project. A 200 with text/html means your server or host returned an HTML page for a missing file, which is what single-page-app fallbacks do by default and is the reason so many people swear the file is fine. A 200 with a size of a few hundred bytes and text/html is almost certainly your 404 page wearing a 200 costume.

Follow redirects too, because a 302 on the icon URL is legal but browsers and crawlers treat it inconsistently:

curl -sIL https://example.com/favicon.ico | grep -Ei '^(HTTP|location|content-type)'

The correct Content-Type values are image/x-icon or image/vnd.microsoft.icon for ICO, image/png for PNG, and image/svg+xml for SVG. The registered IANA type for ICO is image/vnd.microsoft.icon; image/x-icon is the older de facto one. Browsers accept both. What they do not accept gracefully is application/octet-stream, which some misconfigured servers hand back and which Safari in particular has been unhappy about.

If your icon lives under a path like /assets/icons/favicon-32.png, test that exact URL, not the root.

Check 2: the path, not the file

This one is quiet and vicious. Compare:

<link rel="icon" href="favicon.ico">
<link rel="icon" href="/favicon.ico">

The first resolves relative to the current document URL. On https://example.com/ it resolves to https://example.com/favicon.ico and works. On https://example.com/blog/why-i-left-kubernetes/ it resolves to https://example.com/blog/why-i-left-kubernetes/favicon.ico and 404s. Your home page looks perfect. Every article looks broken. You test the home page, conclude it works, and go to bed.

Always use a root-absolute path with a leading slash. The only exception is a site deployed under a subpath, like a GitHub Pages project site at example.github.io/my-project/, where /favicon.ico points at the wrong root entirely and you need the full subpath in the href.

Here is the minimal head block that avoids the whole class of problem:

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

That is four lines and it covers essentially everything. If a generator handed you twenty lines, most of them are for browsers that no longer exist, which is the argument made at length in favicon.ico, PNG or SVG: what to actually ship.

Check 3: the browser cache, which is the actual villain

Browsers do not treat favicons like other images. Chrome keeps them in a dedicated SQLite database in the profile directory, separate from the HTTP cache, and it is stubborn on purpose because refetching an icon on every tab open would be wasteful.

The practical consequence: a hard reload does not clear it. Neither does “Empty cache and hard reload” in the DevTools right-click menu, reliably. I have watched developers do that six times in a row while the old icon sat there unmoved, and it is genuinely not their fault, because every other asset on the page obeys that command.

Things that do work, roughly in order of how much they inconvenience you:

  1. Navigate directly to the icon URL in a tab. Confirm it renders. Then go back to the page and reload. In Chrome this refreshes the stored entry most of the time.
  2. Add a version string to the href: <link rel="icon" href="/favicon.ico?v=3">. The browser treats it as a new resource. This is the reliable one, and it is fine to ship.
  3. Clear “Cached images and files” for all time in the browsing data dialog. Heavy-handed, works.
  4. Quit the browser entirely and delete the Favicons file from the profile directory. Last resort, and only if you are certain which profile you are in.
  5. Test in a fresh profile or a private window, which sidesteps the cache and tells you whether the icon is genuinely fine.

That last one is a diagnostic, not a fix. If it looks right in incognito, your file and your markup are correct and you have a cache problem, full stop. Stop editing code.

Firefox and Safari each keep their own favicon stores with their own eviction rules, and those rules have changed between versions. There is no single command that clears all of them, which is why the version query string is the technique I would actually reach for.

Check 4: the stale root icon nobody remembers uploading

Browsers request /favicon.ico by convention. This predates the <link> element being used for icons at all, and it never went away. Even with a perfectly good tag pointing at /assets/icon-32.png, the root file can still be fetched, and in some contexts it can still win.

The failure mode is specific. Someone uploaded a favicon in 2019. The site got rebuilt. The new icons live in /static/, the tags point there correctly, and the old file is still sitting at the root because nobody deleted it. Some surfaces show the new icon and some show the old one, and the inconsistency drives you mad.

Test it:

curl -s -o /dev/null -w '%{http_code}\n' https://example.com/favicon.ico

If that returns 200 and you did not put a file there, find out what did. Then either delete it or replace it with your current icon. I would replace rather than delete, because a root favicon.ico is genuinely useful: it is the only icon a browser will fetch with no HTML tag at all, and it is what some feed readers, link previews and older tooling look for.

Check 5: Content Security Policy

Tight CSP blocks the favicon request the same way it blocks any other image load. The console message is usually explicit and names both the URL and the directive.

A policy like this blocks an icon served from a CDN:

Content-Security-Policy: default-src 'self'; img-src 'self' data:

Serving the icon from cdn.example.com while img-src only allows 'self' means no icon. Add the host:

Content-Security-Policy: default-src 'self'; img-src 'self' data: https://cdn.example.com

Browsers have not been fully consistent about which directive governs favicon fetches, and behaviour has shifted over time. Read the console error rather than reasoning from the spec, because the error tells you which directive that specific browser applied. And check in more than one browser if the icon is missing in only one of them.

Check 6: is the file actually what it claims to be?

Renaming logo.png to favicon.ico does not produce an ICO file. It produces a PNG with a misleading name. Most modern browsers sniff the bytes and render it anyway, which is why this mistake survives for years before it bites, but it is not guaranteed and it breaks Windows shortcut tooling and some older readers outright.

Check the magic bytes:

file favicon.ico
  #=> MS Windows icon resource - 3 icons, 16x16, 32x32, 48x48

xxd -l 8 favicon.ico
  #=> an ICO begins  0000 0100
  #=> a PNG begins   8950 4e47 0d0a 1a0a

An ICO is a container, not a single image, which is the detail people miss. It can hold 16, 32 and 48 pixel versions in one file, and the browser picks the size it needs. If yours holds only a 256 pixel entry, some contexts will downscale it badly.

Rebuilding the file properly takes about ten seconds with PNG to ICO, and if you are going the other way to inspect what is inside an existing icon, ICO Converter will pull the frames back out. Both run in your browser, so the source art never leaves your machine, which matters more than people expect when the “source art” is an unreleased brand mark.

Check 7: a service worker is answering for you

This is the one that produces the most confused bug reports, because the network request looks successful.

A service worker with a navigation fallback that is too broad will return your cached index.html for any request it cannot match, including /favicon.ico. Status 200. Content-Type text/html. The browser gets HTML where it expected an image, fails to decode it, and shows nothing. No error in the console.

// The bug: every unmatched request gets the app shell
self.addEventListener('fetch', (event) => {
  event.respondWith(
    caches.match(event.request).then((r) => r || caches.match('/index.html'))
  );
});
// Better: only fall back for actual navigations
self.addEventListener('fetch', (event) => {
  if (event.request.mode === 'navigate') {
    event.respondWith(
      caches.match(event.request).then((r) => r || caches.match('/index.html'))
    );
    return;
  }
  // let everything else hit the network normally
});

To confirm before you rewrite anything, open DevTools, go to Application, then Service Workers, tick “Bypass for network” and reload. If the icon appears, you have found it. Unregister the worker while you are testing so you are not fighting a cached copy of the worker itself.

The same shape of bug lives in generic SPA hosting rewrites. A catch-all rewrite rule that sends everything to /index.html will happily do that for your icon path.

Check 8: mixed content, cross-host icons and CDN staleness

An http:// icon URL on an https:// page is blocked as mixed content. Modern browsers do not warn politely about this in the way they used to; they just refuse. Search your templates for http:// in any icon href, particularly in older WordPress themes where the site URL got hardcoded.

Cross-host icons are legal but add failure modes. A favicon on cdn.example.com while the page is www.example.com works fine in browsers, assuming CSP allows it, but Google specifically wants the icon on the same host as the home page, which is covered in getting your favicon into Google’s search results.

Then there is the CDN itself. If Cloudflare, Fastly or your host’s edge cache holds the old icon with a long max-age, your origin can be perfectly correct and your visitors still see the previous file. Purge the specific URL, do not just purge everything and hope. And check what Cache-Control you are sending:

curl -sI https://example.com/favicon.ico | grep -i cache-control

A long max-age on a filename that never changes is a trap you set for your future self. Either use a version query string in the href or accept that icon changes propagate slowly.

If you have got this far and the file, the path, the headers and the cache all check out, generating a fresh set from a single clean source is a reasonable next move, because it eliminates the “maybe the encoder wrote something odd” possibility in one step. The Favicon Generator produces a correct multi-resolution ICO, the PNG sizes and an SVG from one upload, entirely in the browser, with the exact head block to paste. It takes about a minute and rules out an entire branch of the search tree.

Check 9: your framework has opinions

Most modern frameworks inject their own icon tags, and if you also hand-write tags you can end up with two competing sets.

Next.js App Router treats files in the app directory as conventions. app/favicon.ico, app/icon.png and app/apple-icon.png are picked up automatically and the framework writes the <link> tags for you, with a hashed URL. If you also put a file in public/favicon.ico, you have two sources of truth. Pick one. Declaring the icons explicitly through the metadata API removes the guesswork:

export const metadata = {
  icons: {
    icon: [
      { url: '/favicon.ico', sizes: '32x32' },
      { url: '/icon.svg', type: 'image/svg+xml' },
    ],
    apple: '/apple-touch-icon.png',
  },
};

Vite is simpler and catches people anyway. Everything in public/ is copied to the root of dist/ untouched, so that is where favicons belong. An icon in src/assets/ gets hashed and moved, and the literal path you wrote in index.html will not survive the build. If you have set a non-root base, use %BASE_URL% in the tag rather than a bare leading slash.

WordPress hides this in the Customizer, under Appearance, then Customize, then Site Identity, as the Site Icon setting. It wants a square image of at least 512 pixels, generates the smaller sizes itself, and prints the tags through wp_site_icon(). Themes and SEO plugins frequently print their own tags on top of that. If you see three icon tags in view-source, that is why. Set the Site Icon and delete the theme’s hardcoded ones rather than adding a fourth.

On Shopify, theme assets are served from the Shopify CDN, so a literal /favicon.png will 404 no matter how many times you re-upload it. Use the Liquid filter:

<link rel="icon" href="{{ 'favicon.png' | asset_url }}" type="image/png">

Astro, SvelteKit and Nuxt all serve a public/ or static/ folder at the root, same as Vite, with the same trap around base paths on subdirectory deploys.

Tracing one failure end to end

Say Sanjay ships a Next.js marketing site to a static host. The icon shows locally on localhost:3000 and shows nothing in production. He has already re-exported the PNG twice.

Check 1. He runs the curl one-liner against production and gets 200 text/html 4218. That is the whole answer in one line, but he does not know it yet, so he keeps going and confirms the same URL locally returns 200 image/x-icon 15086.

The difference is the Content-Type and the size. 4,218 bytes of HTML is not an icon; it is a page. He opens the URL in a browser and sees his own 404 page rendered, with a 200 status, because the host’s SPA fallback rewrite catches every unmatched path.

Check 9 explains why the path is unmatched. The file was at public/favicon.ico, but the build was configured to output to a directory that the deploy step did not copy public/ into. Locally the dev server reads public/ directly, so it worked. In production the file was never uploaded.

He fixes the deploy config, redeploys, and reruns the curl. Now: 200 image/x-icon 15086. Correct. The tab still shows nothing, because Chrome cached the failure. He opens https://site.com/favicon.ico directly, sees the icon render, reloads the page, and there it is.

Total elapsed: about six minutes once he ran the right command first. The two PNG re-exports before that cost him forty.

When it works on desktop but not mobile

Mobile is not one surface, and that is the whole confusion.

The tab favicon in mobile Safari and Chrome follows your normal rel="icon" tags. An iOS home screen shortcut reads apple-touch-icon, ignores your ICO entirely, and composites any transparency onto black, which is why so many home screen icons look like a logo trapped in a dark box. Android’s install prompt reads the icons array in your web app manifest, and if the manifest is malformed it fails silently with no console error at all.

So “not showing on mobile” needs a follow-up question: not showing where? In a tab, on a home screen, in a share sheet? Each has a different fix, and the manifest one is covered in detail in the manifest and maskable icons post in this cluster. If you are debugging manifest JSON by eye, paste it into JSON Formatter first, because a trailing comma will invalidate the whole file and neither iOS nor Android will tell you.

The usual root cause on mobile is not a broken file but a missing declaration, because desktop needs one tag and mobile needs three more. Producing the whole set at once with the Favicon Generator closes that gap in a single step: ICO, SVG, the 180 pixel touch icon and the manifest PNGs, generated locally with the head block written out.

One more mobile-specific gotcha: iOS caches home screen icons harder than anything else in this article. Once a user has added your site to their home screen, changing apple-touch-icon.png does not update their existing shortcut. The only reliable refresh is removing the shortcut and re-adding it.

Frequently asked questions

Why is my favicon not showing in Chrome even after a hard refresh?

A hard refresh reloads the page and its subresources but does not reliably clear Chrome’s separate favicon database, which lives in the profile directory and has its own lifetime. The quickest fix is to open the icon URL directly in a tab, confirm it renders, then reload the page. If that fails, add a version query string to the href, or clear cached images and files from the browsing data dialog.

How long does it take for a new favicon to appear?

In your own browser it should be immediate once the cache is cleared and the file is served correctly. For other visitors it depends entirely on how long their browser has held the old icon, which can be days and is not something you control directly. Search engines are slower still, because they only refetch the icon when they recrawl your home page.

My favicon works locally but not in production. What changed?

Usually the path or the build output. Local dev servers often serve the project root directly, while a production build copies only specific folders. Check that the file exists in the deployed output, that the href is root-absolute, and that your host is not returning an HTML error page with a 200 status for the missing icon, which is the failure that looks most like success.

Often yes. Browsers request the root path by convention when no usable icon is declared, and some request it opportunistically anyway. If an old file is sitting at that path it can win over your tag in some contexts, which produces maddening inconsistency between surfaces. Delete stale root icons rather than leaving them in place, or better, replace them with the current one.

Can Content Security Policy block a favicon?

Yes. Favicon fetches are treated as image loads, so a policy with a restrictive img-src directive and no allowance for your icon’s host will block them. Browsers have differed over exactly which directive applies and the behaviour has changed over time, so test in more than one browser and read the console, which usually names both the blocked URL and the directive that stopped it.

Why does my favicon show on desktop but not on mobile?

Mobile browsers use different icons for different surfaces. iOS home screen shortcuts read apple-touch-icon, Android install prompts read the web app manifest icons array, and tab favicons follow the normal link tags. A missing icon on one surface usually means a missing tag or a malformed manifest, not a broken image file, so identify which surface is failing before you touch the artwork.

Pulling it together

The discipline that saves the time is running curl before you open your editor. One command tells you whether this is a server problem or a client problem, and that single fork eliminates half the list immediately. Everything downstream of it is quick.

Browser behaviour in this area genuinely moves. Cache eviction rules, which CSP directive governs an icon fetch, how aggressively a given version refetches: these have all changed and will change again. Check MDN or caniuse for anything you are relying on rather than trusting a table you read once, including this one.

And when the icon finally appears, ship a version query string on the href. Future you, deploying a rebrand at 11pm, will be grateful.

Frequently asked questions

Why is my favicon not showing in Chrome even after a hard refresh?

A hard refresh reloads the page and its subresources but does not reliably clear Chrome's separate favicon database, which lives in the profile directory and has its own lifetime. The quickest fix is to open the icon URL directly in a tab, confirm it renders, then reload the page. If that fails, add a version query string to the href, or clear cached images and files from the browsing data dialog.

How long does it take for a new favicon to appear?

In your own browser it should be immediate once the cache is cleared and the file is served correctly. For other visitors it depends entirely on how long their browser has held the old icon, which can be days and is not something you control directly. Search engines are slower still, because they only refetch the icon when they recrawl your home page.

My favicon works locally but not in production. What changed?

Usually the path or the build output. Local dev servers often serve the project root directly, while a production build copies only specific folders. Check that the file exists in the deployed output, that the href is root-absolute, and that your host is not returning an HTML error page with a 200 status for the missing icon, which is the failure that looks most like success.

Does a browser still request /favicon.ico if I have a link tag?

Often yes. Browsers request the root path by convention when no usable icon is declared, and some request it opportunistically anyway. If an old file is sitting at that path it can win over your tag in some contexts, which produces maddening inconsistency between surfaces. Delete stale root icons rather than leaving them in place, or better, replace them with the current one.

Can Content Security Policy block a favicon?

Yes. Favicon fetches are treated as image loads, so a policy with a restrictive img-src directive and no allowance for your icon's host will block them. Browsers have differed over exactly which directive applies and the behaviour has changed over time, so test in more than one browser and read the console, which usually names both the blocked URL and the directive that stopped it.

Why does my favicon show on desktop but not on mobile?

Mobile browsers use different icons for different surfaces. iOS home screen shortcuts read apple-touch-icon, Android install prompts read the web app manifest icons array, and tab favicons follow the normal link tags. A missing icon on one surface usually means a missing tag or a malformed manifest, not a broken image file, so identify which surface is failing before you touch the artwork.

Tools that go with this

Same promise: everything runs in your browser, nothing gets uploaded.

Keep reading