Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

Your favicon works in the browser but not in Google Search results

ErrorFavicon appears in the browser tab but a default icon shows in Google Search

Short answer

Google reads the favicon from a link tag in the head of your home page, and it must be allowed to crawl both the home page and the icon file. The icon must be square and at least 8 by 8 pixels, with more than 48 by 48 recommended. After a fix, Google needs days to weeks to update.

  • Applies to Google Search favicon guidelines, robots.txt as Google parses it
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Fetch the home page the way a crawler does, with no JavaScript, and look for the icon link in the returned HTML.

    curl -s https://example.com/ | grep -i -E '<link[^>]+rel="(shortcut )?icon|apple-touch-icon'
  2. 2Match what you see, then jump to its fix

    1. 1The curl command prints nothing, though the browser shows an iconNo icon link tag in the home page headFix
    2. 2robots.txt has a Disallow rule that matches the home page or the icon fileGooglebot or Googlebot-Image is blockedFix
    3. 3The file is wider than tall, or smaller than 8 by 8 pixelsThe icon is not square, or too small, or in an unsupported formatFix
    4. 4Every check above passes and the old or default icon still showsThe fix is live, but Google has not recrawled yetFix

What does the error look like?

  • Favicon appears in the browser tab but a default icon shows in Google Search
  • Old favicon still shows in search results after changing it

Cause 1 of 4

No icon link tag in the home page head

1Check

Google asks for a link tag in the head of the home page. An app that adds the tag only in client-side JavaScript will not show it in the raw HTML.

curl -s https://example.com/ | head -c 3000

2Fix

Add a link tag to the head of the home page HTML itself. The href can be relative or absolute, and the file may live on a CDN.

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

3Verify

Repeat the first step. The tag is now in the raw HTML.

curl -s https://example.com/ | grep -i 'rel="icon"'

Confirmed by developers.google.com

Did this fix it?

Cause 2 of 4

Googlebot or Googlebot-Image is blocked

1Check

Googlebot must crawl the home page, and Googlebot-Image must crawl the favicon file. Neither may be blocked by robots.txt or other means.

curl -s https://example.com/robots.txt
curl -I https://example.com/favicon.ico

2Fix

Remove the Disallow rule that covers the icon path, or add an Allow rule for the icon file, which overrides a broader Disallow. Make sure a more specific group, such as a Googlebot-Image group, does not block it either, because a crawler follows only its most specific matching group. Then make sure the icon URL returns 200 without a login.

# an Allow rule overrides a broader Disallow for a page or subdirectory
User-agent: *
Disallow: /assets/
Allow: /assets/favicon.ico

3Verify

The icon URL answers with a 200 status.

curl -I https://example.com/favicon.ico

Confirmed by developers.google.com

Did this fix it?

Cause 3 of 4

The icon is not square, or too small, or in an unsupported format

1Check

The icon must have a 1:1 ratio and be at least 8x8 pixels; Google recommends larger than 48x48 pixels. Supported formats are BMP, GIF, ICO, PNG, JPEG, PPM and TIFF.

file public/favicon.ico

2Fix

Export a square image above 48x48 pixels in PNG or ICO, and keep that URL stable afterwards.

<link rel="icon" href="/favicon-96.png" type="image/png">

3Verify

Open the URL and check that it is square.

curl -s -o /tmp/f.png https://example.com/favicon-96.png && file /tmp/f.png

Confirmed by developers.google.com

Did this fix it?

Cause 4 of 4

The fix is live, but Google has not recrawled yet

1Check

Google says recrawling and processing the favicon can take several days to several weeks. Frequent URL changes slow it, and an icon is not guaranteed to appear even when the guidelines are met.

curl -s https://example.com/ | grep -i 'rel="icon"'

2Fix

Ask Google to crawl the home page with the URL Inspection tool in Search Console (Request indexing), then wait.

# Search Console > URL Inspection > enter the home page URL > Request indexing

3Verify

Search for your site name after a few weeks and check the result.

# Search Google for: site:example.com

Confirmed by developers.google.com

Did this fix it?

How do I stop it coming back?

  • Serve one favicon per hostname from the home page, and keep its URL the same.
  • Add a check to CI that the raw HTML of the home page contains the icon link.
  • Do not put the icon behind a login, a redirect loop or a robots.txt Disallow.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Related fixes

Web apps

tsconfig rejects allowImportingTsExtensions

An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly

allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.

2 causes, each with a fix

Web apps

A POST to a Google Apps Script web app returns 405 or a CORS error

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Apps Script web apps run doPost for POST and doGet for GET, and the Apps Script guides describe no other entry points.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.