How to Get the Logo (and Favicon) From Any Website

Get a logo from any website: where favicon and logo files live, curl one-liners, the magpie brand command, and which logo APIs still work in 2026.

MMotherlode Lab9 min read
Magpie title card: How to Get the Logo (and Favicon) From Any Website

Most “get logo from website” tutorials start the same way: paste this URL, https://logo.clearbit.com/<domain>. That URL is dead: Clearbit sunset the public Logo API on December 8, 2025, and as of October 2026 the hostname doesn’t resolve at all. Plenty of the answers you’ll find still point at it.

The good news: every site ships its own logo and favicon in plain HTML. I ran every command in this guide against real sites; what follows is where the files actually live, four methods ranked by effort, and the failure modes that made me stop trusting first-match heuristics.

Before you start: a terminal with curl covers Steps 1–3. Steps 4–5 use the Magpie CLI, one static Go binary built with go build -o magpie ./cmd/magpie after cloning the repo.

Where the logo and favicon actually live

There is no yourdomain.com/logo.png convention. Sites scatter brand assets across five spots, and browsers check them in this order:

  1. /favicon.ico, the 2003 convention. Still served by most sites, often as a stale 16×16 leftover while the good versions live elsewhere.
  2. <link rel="icon"> in the HTML head — usually a PNG or SVG, 32–64px.
  3. <link rel="apple-touch-icon"> — 180×180 PNG, the highest-resolution icon most sites publish. This is the one to grab if you want a crisp square icon.
  4. A web app manifest (<link rel="manifest">) listing icon files up to 512×512. Common on SPAs and PWAs.
  5. og:image — the social-preview image. Not a favicon, but on plenty of marketing sites it’s the only logo-shaped file in the head.

Here is Python.org’s head, unedited:

<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144"
      href="/static/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon" href="/static/apple-touch-icon-precomposed.png">
<meta property="og:image"
      content="https://www.python.org/static/opengraph-icon-200x200.png">

Note the href values: relative paths. Whatever you scrape, you resolve them against the page URL. /static/favicon.ico means https://www.python.org/static/favicon.ico.

The logo is a different hunt. It sits in one of four places:

  • An <img> tag in the header, almost always with logo in its src path
  • An inline <svg> with class="logo" or similar
  • A CSS background-image, which static HTML never reveals (you need a rendered DOM)
  • og:image, again, as the fallback

The shortcuts that still work (favicons only)

If you need a favicon for a browser list, a link card, or a dashboard row, two free services save you any parsing. Neither gives you a full logo.

Google’s favicon service. Request https://www.google.com/s2/favicons?domain=python.org&sz=64 and you get a 301 redirect to t0.gstatic.com/faviconV2?..., which returns a 64px PNG (1,058 bytes for python.org when I tested it). The sz parameter is a size hint; 256 is the largest value Google documents. Two limits: the icon comes from Google’s cache, so it can be months stale after a rebrand, and sites that block Googlebot’s indexer sometimes get the generic globe placeholder.

DuckDuckGo’s icon service. https://icons.duckduckgo.com/ip3/python.org.ico returned the real icon straight, 200 and 15KB. Same caveats: favicons only, cached, third-party.

And the dead one, for the record: logo.clearbit.com stopped serving on December 8, 2025. Brandfetch and logo.dev both published Clearbit migration guides. If you’d rather avoid services entirely, Apify hosts a dozen “website logo” actors — most wrap the same head-parsing this article teaches, behind a paid per-result meter.

Step 1: Check /favicon.ico with curl

The cheapest possible method, no parsing:

curl -sI https://www.python.org/favicon.ico

What you should see: HTTP/2 200 with content-type: image/x-icon. Download it with curl -so favicon.ico <url>/favicon.ico.

Failure case one: the site redirects (rust-lang.org sends /favicon.ico to another path), so add -L to follow. Failure case two: the file exists but is the wrong one. GitHub’s /favicon.ico is fine, but plenty of sites serve a 16×16 relic while their real icons are the apple-touch-icon files. If the icon looks blurry in a 64px slot, this is why. Move to Step 2.

Step 2: Read the head like a scraper

One line of shell gets every icon link plus the social image:

curl -s https://www.python.org/ \
  | grep -oE '<link[^>]*(icon|manifest)[^>]*>|<meta property="og:image"[^>]*>'

What you should see: the <link> tags from the python.org example above. Pick apple-touch-icon for the largest PNG, og:image for the widest image, and resolve every relative URL against the origin.

Failure cases I hit testing this:

  • data: URIs. example.com declares <link rel="icon" href="data:,">, which is a polite way of saying “no favicon.” Filter out href values starting with data:.
  • Empty heads. Sites that render everything in JavaScript ship a nearly bare <head> from the server. Static HTML has nothing to give you; you need a rendered DOM (Step 3’s note, or a headless browser).

Step 3: Hunt the logo in the HTML

Logos have no standard. The closest thing to a convention: an <img> whose src contains logo.

curl -s https://www.python.org/ \
  | grep -oE '<img[^>]*src="[^"]*logo[^"]*"' | head -3
# <img src="/static/img/python-logo.png" ...>

Failure cases, all real, all hit during testing for this guide:

  • Wrong brand. Run the same grep against github.com and the first logo match is logo-duolingo-14477f9e54a6.svg, a customer-story asset from GitHub’s homepage. First-match-by-filename is a heuristic, and marketing homepages are full of other companies’ logos.
  • No URL at all. Stripe’s logo is an inline SVG. There is no src to grab; the most useful thing static HTML can tell you is the SVG’s class name, which you’d then target with a DOM parser.
  • Lazy loading. Some sites set the real logo in data-src and put a placeholder in src. Grep for both.

Step 4: Get the logo from a website in one command

Everything above, in one call, is why I use magpie for this job. Its brand command fetches the page, applies the quality gate, and returns the brand surface as JSON:

magpie brand https://www.python.org/
{
  "colors": null,
  "favicon": "https://www.python.org/static/favicon.ico",
  "final_url": "https://www.python.org/",
  "fonts": null,
  "logo": "/static/img/python-logo.png",
  "title": "Welcome to Python.org",
  "url": "https://www.python.org/"
}

Verbatim output, colors: null included: python.org keeps its palette in an external stylesheet, and inline styles are all this command reads. What it does under the hood, verified against the source: logo by precedence, first <img> with logo in its src, then inline <svg class*=logo> (reported as the class name, since an inline SVG has no URL), then og:image as fallback. Favicon comes from the head links and gets rewritten to an absolute URL. It also lifts hex colors and font families from inline styles, free, no LLM in the loop.

The honest limits, from the same live tests:

  • magpie brand https://github.com returns the Duolingo SVG, because the img-heuristic and my grep fail the same way. When the first match wins, other brands’ assets win with it.
  • Text-only sites return an empty logo. Hacker News gives "logo": "", correctly: there is no image logo to find.
  • It reads inline <style> blocks and style= attributes only. Wikipedia yielded 13 colors, GitHub 2; neither is the brand palette, because both sites keep their palettes in external stylesheets.
  • JS-shell pages fail loudly instead of returning garbage: magpie brand https://vercel.com exits with code 8, quality blocked (empty).

That last one is a feature. A scraper that returns an empty logo on a blocked page teaches your pipeline to trust emptiness. Exit code 8 teaches it to retry.

Magpie is a local Go binary (AGPL-3.0-or-later or a commercial license, free to download, no API key for brand), and the same command is exposed as one of its 13 MCP tools, so an agent can call it.

Step 5: Bulk: logos for a list of domains

brand takes one URL. For a list, a loop is enough:

while read -r domain; do
  echo "== $domain"
  magpie brand "https://$domain" --out "$domain.json" \
    || echo "FAILED $domain" >> failures.txt
done < domains.txt

Each JSON file lands next to your list; failures collect in one file. Sleep between requests if the list is long and the domains are small (Magpie throttles per host automatically, but spread across hosts a loop this naive is as fast as your connection).

When a paid logo API is still the right call

Local extraction is best-effort: it finds what the page declares, and it misfires when a page mixes brands. If you’re building a B2B product where a wrong logo is worse than a missing one (a CRM, an enrichment pipeline), use a curated logo database instead. Brandfetch’s API is the incumbent: 100 brand fetches free (one-time), then from $99/month billed yearly ($129 month-to-month) for 2,500 fetches, with $0.10 per-fetch overage, per their pricing page as of October 2026. logo.dev positions itself as a drop-in Clearbit replacement; verify its current pricing before you commit, I didn’t.

The division of labor I landed on: magpie brand for one-off checks, internal tools, and agent workflows where the data should stay local; a logo API where the logo is the product and wrongness costs money.

FAQ

How do I get a website’s favicon without writing code? Use Google’s service: https://www.google.com/s2/favicons?domain=example.com&sz=64. DuckDuckGo’s icons.duckduckgo.com/ip3/example.com.ico works too. Both return cached favicons, not the site’s current file.

Where is the favicon file located on a website? Usually /favicon.ico at the root, plus <link rel="icon"> and <link rel="apple-touch-icon"> tags in the HTML head. SPAs often declare icons only in a manifest.json.

How do I download a logo in high resolution? Try, in order: apple-touch-icon (180px), og:image (often 200–1200px wide), the site’s press/brand page, or an SVG in the header. A favicon will never look good at 500px.

Why does the Google favicon API return a blank or generic icon? The icon is missing from Google’s index, the site blocks the crawler that feeds it, or the cache predates a rebrand. Pull the favicon from the site directly instead.

Is it legal to scrape a website’s logo? Logos are trademarks. Fetching one to display next to that company’s own link or data is standard practice, but implying endorsement or slapping a brand’s logo on your own marketing is not. For commercial products, a licensed logo API exists for exactly this reason.

Make it stick

Whichever method you pick, do two things. Resolve relative URLs against the final page URL, not the URL you typed (geo-redirects move both: my GitHub fetch landed on github.com/?locale=fr-fr). And pin the bytes you depend on: download the file, hash it, and re-check on a schedule, because the moment a site rebrands is the moment your cached logo starts lying.

For the sibling job, pulling a site’s color palette properly (DOM and stylesheets, not just inline styles), see How to Extract a Color Palette From Any Website. For the structured metadata hiding in the same <head>, see How to Extract JSON-LD & Schema.org Data From Any Page. And if this was your first taste of parsing pages yourself, the data extraction primer covers the whole pipeline from fetch to clean output.

Stop renting credits.

One flat price, your machine, your keys.

Download free for Windows, macOS and Linux

Windows · macOS · Linux $49/mo flat, cancel anytime