Skip to content

Instantly share code, notes, and snippets.

@iuzn
Created October 20, 2025 20:34
Show Gist options
  • Select an option

  • Save iuzn/bbd4df2823bd69643a8553d6967f68eb to your computer and use it in GitHub Desktop.

Select an option

Save iuzn/bbd4df2823bd69643a8553d6967f68eb to your computer and use it in GitHub Desktop.
Google favicon API endpoints. Customize favicon retrieval by changing domain and size parameters.

Google Favicon API Cheat Sheet

Fetch a website’s favicon easily using Google’s public endpoints:


Basic Endpoint

https://www.google.com/s2/favicons?domain=DOMAIN
  • DOMAIN: The domain name (e.g., stackoverflow.com)
  • Returns: The default favicon (PNG, usually 16px)

Custom Size Endpoint

https://www.google.com/s2/favicons?domain=DOMAIN&sz=SIZE
  • sz (optional): Requested PNG size. Accepts values like 16, 32, 64, 128 (default: 16px)
  • Example:
    https://www.google.com/s2/favicons?domain=twitter.com&sz=64
    

Fetch Favicon by Site URL

You can provide the full site URL, not just the domain:

https://www.google.com/s2/favicons?domain=https://www.notion.so

Advanced: S2 Static Favicon Endpoint

For specific integrations, Google uses a slightly different endpoint in its services:

https://www.google.com/s2/favicons?sz=SIZE&domain_url=SITE_URL
  • domain_url: Full website address
  • Example:
    https://www.google.com/s2/favicons?sz=32&domain_url=https://github.com
    

Notes

  • The favicon returned is always in PNG format.
  • If the domain does not have a favicon, Google may return a blank or fallback icon.
  • These endpoints are not officially documented by Google, but are widely used in browser extensions, apps, and web tools.
  • Reliable for most public sites, but results may vary for uncommon domains.

Quick Usage Examples

// 16x16 PNG favicon for Stack Overflow
https://www.google.com/s2/favicons?domain=stackoverflow.com

// 128x128 PNG favicon for Notion
https://www.google.com/s2/favicons?domain=notion.so&sz=128

// 32x32 PNG favicon for GitHub (using domain_url)
https://www.google.com/s2/favicons?sz=32&domain_url=https://github.com

Feel free to copy and use these endpoints in web projects, browser extensions, and scripts!


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment