How to get a company logo from a domain: 5 ways
Scrape it, use a favicon service, ask Wikidata, call a logo CDN or a brand API. What each way returns, what it costs you, and when to use which.
You have a domain, stripe.com, and you want the company's logo on screen: in a CRM row, a list
of integrations, an invoice header or a chat answer. There are five common ways to get it. They
differ less in difficulty than in what you actually get back.
1. Scrape the site yourself
Every site declares icons in its HTML: <link rel="icon">, apple-touch-icon, mask-icon and
usually an og:image. A short script finds them. Save this as find-icons.mjs and run it with
Node 18 or later: node find-icons.mjs stripe.com.
const domain = process.argv[2];
if (!domain) throw new Error("Usage: node find-icons.mjs <domain>");
const res = await fetch(`https://${domain}`, { redirect: "follow" });
const html = await res.text();
const base = res.url;
const icons = [];
for (const match of html.matchAll(/<link\b[^>]*>/gi)) {
const tag = match[0];
const rel = /\brel=["']([^"']+)["']/i.exec(tag)?.[1]?.toLowerCase() ?? "";
const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
if (!href || !/(^|\s)(icon|apple-touch-icon|mask-icon)(\s|$)/.test(rel)) continue;
icons.push({ rel, url: new URL(href, base).href });
}
const og = /<meta\b[^>]*property=["']og:image["'][^>]*content=["']([^"']+)["']/i.exec(html);
console.log({ icons, ogImage: og ? new URL(og[1], base).href : null });
What you get is a list of candidates, not an answer. The wordmark itself is often an inline
<svg> in the header, which this script does not see. The og:image is usually a marketing
banner. Many homepages also show a strip of their customers' logos, so "the first SVG on the
page" is regularly somebody else's brand.
Two more things bite in production. Sites behind bot protection return a challenge page instead
of HTML. And if the domain comes from a user, fetching it from your server is a server-side
request forgery risk: a domain can resolve to 127.0.0.1 or an address inside your cloud, so you
must check where it resolves before you connect.
Use it for: a one-off script over a list you control.
2. Use a favicon service
Google and DuckDuckGo serve favicons by domain, with no key:
https://www.google.com/s2/favicons?domain=stripe.com&sz=64
https://icons.duckduckgo.com/ip3/stripe.com.ico
This is the fastest way to get something. But a favicon is a browser tab icon, not a logo: a small square, often drawn for 16 or 32 pixels, with no wordmark, no SVG and no variant for dark backgrounds. Scaled up in a card, it looks it.
Use it for: tab-sized icons where a blurry edge does not matter.
3. Ask Wikidata
Wikidata records an official logo for many notable companies, as property P154 ("logo image"),
pointing at a file on Wikimedia Commons. This script looks a company up by its English Wikipedia
title and prints the file URL. Save it as wikidata-logo.mjs:
const title = process.argv[2] ?? "Stripe, Inc.";
const api = new URL("https://www.wikidata.org/w/api.php");
api.search = new URLSearchParams({
action: "wbgetentities",
sites: "enwiki",
titles: title,
props: "claims",
format: "json",
});
const res = await fetch(api, { headers: { "User-Agent": "logo-lookup-example/1.0" } });
const data = await res.json();
const entity = Object.values(data.entities ?? {})[0];
const file = entity?.claims?.P154?.[0]?.mainsnak?.datavalue?.value;
console.log(
file
? `https://commons.wikimedia.org/wiki/Special:FilePath/${encodeURIComponent(file)}`
: "No logo image (P154) on this item",
);
When it has an answer, it is often a clean SVG. The catches: you need the company's name or Wikidata id rather than its domain, coverage stops at companies notable enough for Wikipedia, and the file is whatever an editor uploaded, which may be an old logo. Check each file's license page before you redistribute it.
Use it for: well-known brands, or as one signal among several.
4. Use a logo CDN
A logo CDN does the work of the first three behind one URL per domain. This is ours:
<img src="https://brandidentityapi.com/logo/stripe.com?size=128" alt="Stripe logo" width="64" height="64" />The CDN picks the best candidate, trims it, resizes it and caches it. Parameters choose the type
(icon, symbol or the logo wordmark), the size (128 pixels by default), the format (WebP for
browsers, PNG for other clients, or ask for png, jpeg and svg) and the background you will place it on:
<img src="https://brandidentityapi.com/logo/stripe.com?type=logo&background=dark&size=320" alt="Stripe logo" />Logo CDNs differ most in their terms. Check whether the free tier needs an attribution link, whether you may fetch the images from your server, and whether you may cache them. Ours never costs a credit: the free plan includes 500,000 logo requests a month, Starter 3 million and Growth unlimited, with per-minute burst limits. It needs no attribution, and allows all three.
Use it for: anywhere a logo is displayed: lists, avatars, emails, generated PDFs. For emails
and PDFs, add format=png: many email clients and PDF renderers cannot show WebP.
5. Call a brand API
A brand API returns the whole record for a domain, the company's brand assets: every logo variant with its formats, the brand colors, the fonts and company facts. You store it and decide what to show.
curl https://brandidentityapi.com/v1/brands/stripe.com \
-H "Authorization: Bearer $BRAND_IDENTITY_API_KEY"Each logo in the response has a type and a theme, the color of its ink. This picks an SVG
wordmark for a given background and falls back to an icon:
export function pickLogo(brand, background = "light") {
const ink = background === "light" ? "dark" : "light";
const candidates = [
brand.logos.find((logo) => logo.type === "logo" && logo.theme === ink),
brand.logos.find((logo) => logo.type === "logo" && logo.theme === null),
brand.logos.find((logo) => logo.type === "icon"),
];
const logo = candidates.find(Boolean);
if (!logo) return null;
const svg = logo.formats.find((format) => format.format === "svg");
return (svg ?? logo.formats[0])?.src ?? null;
}
Use it for: products that store brand data next to a company record, or need colors and fonts as well as the logo.
Side by side
| Way | Your effort | What you get | Dark variant | SVG |
|---|---|---|---|---|
| Scrape it yourself | High | Candidates you must judge | Rarely | Sometimes |
| Favicon service | None | A small square icon | No | No |
| Wikidata and Commons | Medium | The recorded logo of notable companies | No | Often |
| Logo CDN | None | A sized image per domain | Depends on the provider | Depends |
| Brand API | Low | Every variant, plus colors, fonts and facts | Depends on the provider | Depends |
Which one to use
If you need an icon in a browser tab, a favicon service is enough. If you show logos in a product, use a logo CDN and stop thinking about it. If the logo is part of a company record you keep, call a brand API once, store the result, and serve the files from the stored URLs.
Whichever you pick, ask the provider three questions before you build on it: can I cache what I get, can I fetch it from my server, and what happens to my app if you shut down? The last one is not hypothetical: Clearbit's free Logo API closed in December 2025. Storing the domain rather than a provider's full URL makes the next move a one-line change.
To see what comes back for a domain before writing any code, try the free brand color extractor and font finder. The Logo API docs list every CDN parameter, and the Brand API reference describes every field in the record.