问答
Why is my new favicon still not showing? (browser cache)
Replacing the file rarely changes what you see. Why browsers cache icons so hard, which cache to clear in each browser, and the one fix that works.
更新于 2026年2月24日 · 约 3 分钟
You replaced the icon, the file on the server is new, and the tab still shows the old one. This is almost always caching, and it is rarely one cache — it is several, each keyed differently.
Why it happens
A browser stores a favicon against its URL. If the URL did not change, the browser has no reason to fetch again. /favicon.ico is the worst case: many browsers request it automatically and cache it hard, often without any link tag telling them otherwise.
Three caches are usually involved:
- The browser’s normal HTTP cache.
- A separate favicon store — Chrome keeps icons in its own database, independent of ordinary pages.
- A CDN or a service worker sitting in front of your origin.
Clearing one does not clear the others, which is why “I hard-refreshed and it is still wrong” is so common.
The fix: change the cache key
The reliable answer is to never reuse a URL for changed content.
| Approach | How | Trade-off |
|---|---|---|
| Hashed filename | favicon.a1b2c3.ico | Best; needs a build step or a manual rename |
| Version query | favicon.ico?v=2 | Simple; a few legacy clients ignore it |
| Short cache headers | Cache-Control: max-age=3600 | Shrinks the blast radius; still stale for an hour |
Hashed filenames are strongest because the URL genuinely changes. A version string is good enough for most sites:
<link rel="icon" href="/favicon.ico?v=2" sizes="any">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?v=2">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?v=2">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=2">
<link rel="manifest" href="/site.webmanifest?v=2">
Bump the number every time the artwork changes. The manifest needs the same treatment, because it points at the larger icons that Android and PWA installs read.
Set a sane cache policy too, so the next change is not stuck for months:
location ~* \.(ico|png|svg|webmanifest)$ {
add_header Cache-Control "public, max-age=604800";
}
A week is long enough to be useful and short enough to recover from a mistake.
Clearing caches by hand
When you cannot change the URL — someone is looking at a live site right now — force each browser to drop its copy.
| Browser | What to do |
|---|---|
| Chrome / Edge | Hard reload (Ctrl+Shift+R, or ⌘+Shift+R). If the tab icon persists, clear “Cached images and files” in settings; favicons are stored separately from pages. |
| Firefox | Hard reload first, then Settings → Privacy → Clear Data → Cached Web Content. |
| Safari | Develop → Empty Caches, or clear history. Safari is the most stubborn and sometimes needs a restart. |
| Any | Open the icon URL directly, reload it, then reload the site. |
For automated checks, always test in a fresh profile or a private window. A warm profile will keep lying to you.
Common mistakes
Replacing the file in place. Same URL, same cached bytes. Rename or version it.
Only changing the .ico. If the head still points at an old 32px PNG, browsers prefer that and you see no change at all. Update every icon link together.
Forgetting the manifest. The Android installer caches site.webmanifest, so a stale file keeps old icons even after a reinstall.
Ignoring a service worker. A PWA service worker can serve a cached icon list forever. Bump the cache version in the worker when icons change.
Expecting search results to update immediately. Engines cache favicons on their own schedule. There is no button for this — ship the change and wait.
Testing with a warm profile. Your browser has been caching the old icon for weeks. Verify in a clean session before you conclude the deploy failed.
Where this tool fits
The favicon generator exports correctly named files and the link tags above, so the first deploy is cache-friendly. If you are not sure what a live site is serving right now, the favicon checker lists every icon the site references and whether each one resolves.
Frequently asked questions
▸ Why does my browser still show the old favicon after I replaced it?
Browsers cache an icon against its URL. If the URL did not change, the browser has no reason to re-fetch it, and favicons are cached more aggressively than normal assets. Change the file name or add a version query so the URL is new.
▸ How do I force Chrome to reload a favicon?
Start with a hard reload. If the tab icon persists, clear Cached images and files in the browser settings, since Chrome stores favicons separately from the normal page cache.
▸ Does a version query string really work?
For most browsers, yes. Appending ?v=2 to the icon URL makes it a different cache key. A few legacy clients ignore the query, which is why a hashed filename is the more robust option.
▸ Why do Google search results still show the old icon?
Search engines cache favicons on their own schedule and there is no button to force an update. Ship the change, make sure the file is reachable, and wait for the next recrawl.
▸ Can a service worker keep an old favicon?
Yes. A PWA service worker can serve a cached icon list indefinitely, so bump the cache version in the worker after changing icons.