Skip to content

About

Favicon API for any website: logoapi.sh/icon/{domain} returns a clean SVG icon, the site's own favicon, or a letter tile (or 404). Free, no API key, no signup. npm: favicon-api.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Favicon API: site icon for any domain, free, no key

Get the icon of any website by domain. No API key, no signup, no attribution.

<img src="https://logoapi.sh/icon/github.com" alt="" width="32" height="32">
  • URL pattern: https://logoapi.sh/icon/{domain}
  • Order: a clean SVG icon if the brand is in our catalog, else the site's own favicon (ICO, PNG or SVG), else a letter tile.
  • Clean miss: add ?fallback=404 to get HTTP 404 instead of the tile, so your own placeholder shows.
  • Which one you got: the X-Logo-Fallback response header says favicon or tile. No header means a catalog icon.
  • Dark mode: https://logoapi.sh/dark/icon/{domain} for catalog icons.
  • Limits: free up to 2M requests a month per site. CDN, Access-Control-Allow-Origin: *.

Tested on

Domain Result
github.com catalog SVG icon
news.ycombinator.com site favicon
jvns.ca (small blog) site favicon (ICO)
allbirds.com (Shopify store) site favicon (PNG)
a dead or unknown domain letter tile, or 404 with ?fallback=404

npm

npm i favicon-api
const { faviconUrl } = require('favicon-api');
faviconUrl('https://www.github.com/logoapi');           // https://logoapi.sh/icon/github.com
faviconUrl('jvns.ca', { fallback: '404' });             // ...icon/jvns.ca?fallback=404
faviconUrl('stripe.com', { dark: true });               // ...dark/icon/stripe.com

It only builds URLs. No network calls, no dependencies.

One-file bookmarks example

<!doctype html>
<ul id="list"></ul>
<script>
  const links = ["https://github.com", "https://news.ycombinator.com", "https://jvns.ca", "https://allbirds.com"];
  for (const url of links) {
    const host = new URL(url).hostname.replace(/^www\./, "");
    const li = document.createElement("li");
    const img = new Image(16, 16);
    img.alt = "";
    img.src = `https://logoapi.sh/icon/${host}?fallback=404`;
    img.onerror = () => { img.replaceWith(document.createTextNode(host[0].toUpperCase() + " ")); };
    li.append(img, " ", url);
    document.getElementById("list").append(li);
  }
</script>

More: logoapi.sh/favicon. Company logos, stock tickers and crypto: logoapi/logo-api, logoapi/crypto-logos.

Licence

Code and docs: MIT. Icons belong to their sites and are trademarks of their owners. Owners can ask for a change or removal at https://logoapi.sh/claim.

About

Favicon API for any website: logoapi.sh/icon/{domain} returns a clean SVG icon, the site's own favicon, or a letter tile (or 404). Free, no API key, no signup. npm: favicon-api.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages