Post

Favicon Service: Use website icons without hosting them

A practical guide to fetching website favicons from external services without storing them yourself.

Fetch website favicons without hosting them yourself

Favicons are small, but they show up everywhere: browser tabs, bookmarks, link previews, dashboards, and internal tools. If your product lets users save external links, you will eventually need a way to display site icons reliably.

The first idea is usually to download and store icons on your own server. That works, but it also means dealing with refreshes, broken files, inconsistent sizes, and a growing pile of assets that are not part of your core product.

What a favicon is

A favicon is the icon associated with a website.

Historically the common location was /favicon.ico at the root of a domain, but many modern sites also publish PNG, SVG, and app icons through their HTML metadata.

The easiest option

If you only need a lightweight icon for display, a hosted favicon service is often enough.

For example, these URLs can return the favicon for a domain:

That approach is useful when:

  • you need icons for user-provided links
  • you do not want to maintain your own icon cache yet
  • a small fallback image is acceptable

Google favicon endpoint

One of the simplest endpoints to use is:

1
https://www.google.com/s2/favicons?domain=<domain>&sz=<size>

Parameters:

  • domain: the target domain
  • sz: the preferred size, such as 32, 64, or 128

Examples:

  • https://www.google.com/s2/favicons?domain=google.com&sz=128
  • https://www.google.com/s2/favicons?domain=github.com&sz=64

This is convenient, but it is still a third-party service, so build in a fallback.

Other favicon services

Depending on reliability, coverage, and image quality, you may want alternatives:

When to self-host instead

Hosted favicon services are great for simple interfaces, but they are not always the right long-term answer.

Consider self-hosting or caching when:

  • you need predictable uptime
  • you need larger or branded asset sizes
  • you want to avoid a third-party dependency in a critical flow
  • you need to support internal domains that public services cannot reach

Open-source option

If you want more control, take a look at:

That route gives you the flexibility to fetch, normalize, cache, and serve icons on your own terms.

Manual options

Sometimes the simplest solution is still useful.

  • Open <domain>/favicon.ico directly in a browser
  • Inspect the page source and look for <link rel="icon" ...>
  • Download with a CLI tool

Example with curl:

1
curl -L https://www.google.com/favicon.ico -o favicon.ico

Example with PowerShell:

1
Invoke-WebRequest -OutFile "icon.ico" -Uri "https://www.google.com/favicon.ico"

Browser-specific shortcuts

Chromium-based browsers also expose internal favicon URLs:

1
2
chrome://favicon/https://google.com
edge://favicon/https://google.com

These are handy for quick inspection during debugging, but they are not a portable production solution.

Final advice

If you are building an internal dashboard or a lightweight bookmark feature, an external favicon service is usually enough to get started quickly. If the icon becomes part of an important user-facing workflow, move to a cached or self-hosted approach before it becomes a reliability problem.

Also remember that logos are part of a company’s brand. Make sure your usage fits the product context and does not imply an official relationship where none exists.

Additional resources