Favicon API

Find the favicon of any web site, the avatar of an email address the logo of a sports team, the icon of a currency, the flag of a country or the logo of a brand or an app. One URL, ready for <img src>.

  • Returns a redirect to the favicon of a web site given by its domain name.
  • Finds the icon the way a browser does:
    • icons declared in the head of the main page (icon, shortcut icon, apple-touch-icon),
    • only when none of them works, the standard locations: /favicon.svg, /favicon.png, /apple-touch-icon.png, /favicon.ico,
    • when there is none (or the site cannot be reached), the BIMI logo of the domain published in its DNS for email clients.
  • Picks the icon of the size you prefer (sizes read from the images, an ICO file can hold several): that size or SVG, otherwise the nearest larger one, otherwise the largest one available.
  • Checks that the icon really exists and is an image.
  • Returns the avatar of an email address: from Gravatar, Libravatar or the BIMI logo of its domain, otherwise a generated image with the initials.
  • Returns a redirect to the logo of a basketball, baseball, football, soccer, hockey, rugby, volleyball or handball team given by its name (Team logos).
  • Returns the icon of a currency as an SVG: the symbol of a fiat currency with the small flag of its country (EUR, GBP) or the icon of a crypto currency (BTC, tether), optionally with the icon of its network (Currency icons).
  • Returns the rectangular flag of a country given by its ISO 3166-1 code or English name (DE, jpn, 840, germany) as an SVG (Flags).
  • Returns the logo of a company, brand or product (github, heineken) or the icon of a mobile app (calm) given by its name, from Simple Icons, Wikidata, the App Store or Google Play (Logos).
  • Results are cached, so repeated requests are fast.
  • AI agents and LLMs find the API description in /llms.txt (full: /llms-full.txt), the OpenAPI specification and /.well-known/ai-plugin.json.
  • A JavaScript library fills <img> elements for you: give it a domain name, any URL of a site (https://www.bbc.com/news) or an email address.

If you have found this API useful but feel that a feature is missing, please share your suggestions with us via email.


Get the favicon of a web site

curl -I 'https://favicon.intami.pl/favicon/wikipedia.org'
URL parameterDescriptionHints
idDomain name of the web site, e.g. wikipedia.org or www.github.com, or an email address (see Get avatar).Required. Without scheme, path and port; IP addresses are not accepted. International domain names are supported.
preferredSizeQuery parameter: preferred icon size in pixels.Optional, default 64. A number from 1 to 1024. When there is no icon of that size, the nearest larger one is returned, otherwise the largest one.
fallbackQuery parameter: URL of an image to redirect to when the favicon cannot be determined.Optional. Absolute http(s) URL, URL encoded. Ignored for email addresses.

Responses:

StatusDescription
301 Moved PermanentlyThe Location header contains the URL of the favicon.
302 FoundThe favicon cannot be determined and fallback is given: the Location header contains the fallback URL.
404 Not FoundThe favicon cannot be determined (no icon or the site cannot be reached).
304 Not ModifiedThe If-None-Match request header matches the ETag of the redirect (301 and 302 have one).
400 Bad RequestInvalid domain name, email address, preferred size, color or fallback URL.

Example - download the favicon:

curl -L 'https://favicon.intami.pl/favicon/github.com' --output favicon

Example - show the favicon in a page:

<img src="https://favicon.intami.pl/favicon/github.com?preferredSize=32" width="32" height="32" alt="">

Example - show your own image when there is no favicon:

<img src="https://favicon.intami.pl/favicon/github.com?fallback=https%3A%2F%2Fexample.com%2Fdefault-icon.png" width="32" height="32" alt="">

Get the avatar of an email address

curl 'https://favicon.intami.pl/avatar/john.smith@example.com' --output avatar

The avatar is available at /avatar/{email} and, the same, at /favicon/{email}.

  • Three sources are asked at the same time; the first one in this order that has an image is returned:
    1. Gravatar,
    2. Libravatar: the avatar server of the email domain when the domain announces one in its DNS (SRV records _avatars-sec._tcp, _avatars._tcp), otherwise the central Libravatar,
    3. BIMI: the logo of the email domain (or its organizational domain) published in its DNS for email clients (default._bimi TXT record).
  • When there is none, an SVG image is generated: a square with white initials on a colored background, always the same for the same address.
  • Initials: the part before @ without a +tag is split at ., - and _; the first letters of the first and the last part are used (john.smith, john-paul-smith, john_smith give JS), otherwise the first two letters (jsmith gives JS), in upper case.
  • The image is returned by the API itself, there is no redirect. SVG images from the sources are returned only when they are safe (no scripts, no external references, at most 32 KB).
URL parameterDescriptionHints
idEmail address, e.g. john.smith@example.com.Required. Upper and lower case letters are the same address.
preferredSizeQuery parameter: preferred avatar size in pixels.Optional, default 64. A number from 1 to 1024 (Libravatar gives at most 512). Also the size of a generated image.
colorQuery parameter: background of a generated image, color (a color chosen by the address) or mono (black).Optional, default color. The letters are always white.

Responses:

StatusDescription
200 OKThe avatar or the BIMI logo (image/png, image/jpeg, image/svg+xml, ...) or the generated image (image/svg+xml), with an ETag header.
304 Not ModifiedThe If-None-Match request header matches the ETag of the image.
400 Bad RequestInvalid email address, preferred size or color.

Example - show the avatar in a page:

<img src="https://favicon.intami.pl/avatar/john.smith@example.com?preferredSize=32&color=mono" width="32" height="32" alt="">

Get the icon of a currency

curl 'https://favicon.intami.pl/currency/USDT?withNetwork=true'
  • The answer is always an SVG image of the requested size (no redirect), ready for <img src>.
  • Fiat currencies are given by their ISO 4217 code (EUR, USD, GBP, ...) or English name (euro, us-dollar, pound-sterling, yen) and shown as their symbol (€, $, £; the code when there is none) in a colored circle with the small round flag of the country in the bottom-right corner (circle-flags, MIT), so USD and CAD can be told apart; EUR has the flag of the European Union, XAF of Cameroon, XOF of Côte d'Ivoire, XCD of Saint Kitts and Nevis. Fiat codes and names are checked first (sol is Solana, the Peruvian sol is Peruvian Sol).
  • Crypto currencies (about 1850) are given by their symbol (BTC), id (bitcoin, tether) or name (Wrapped Bitcoin), case-insensitive; icons from web3icons (MIT). When several tokens have the same symbol, the native coin of a network wins, then the one with the higher market cap.
  • withNetwork=true adds the icon of the network of a crypto currency in the bottom-right corner: the network of a native coin (BTC - Bitcoin, ETH - Ethereum, BNB - BNB Smart Chain), otherwise the first network the token is listed on (USDT - Ethereum). Without a known network the plain icon is returned; it is ignored for fiat currencies.
URL parameterDescriptionHints
namePath: ISO 4217 code or English name of a fiat currency or symbol, id or name of a crypto currency, e.g. EUR, euro, btc, tether.Required. At most 64 characters, URL encoded.
preferredSizeQuery parameter: width and height of the image in pixels.Optional, default 64. A number from 1 to 1024.
withNetworkQuery parameter: true adds the icon of the network of a crypto currency.Optional, default false. true or false.
fallbackQuery parameter: URL of an image to redirect to when the currency cannot be found.Optional. Absolute http(s) URL, URL encoded.

Responses:

StatusDescription
200 OKThe SVG image of the currency (image/svg+xml) with an ETag.
304 Not ModifiedThe If-None-Match request header matches the ETag of the image.
302 FoundThe currency cannot be found (or its icon cannot be fetched) and fallback is given: the Location header contains the fallback URL.
404 Not FoundThe currency cannot be found.
400 Bad RequestInvalid currency name, preferred size, withNetwork or fallback URL.
502 Bad GatewayThe icon cannot be fetched at the moment.

Example - show the icon in a page:

<img src="https://favicon.intami.pl/currency/USDT?withNetwork=true&preferredSize=32" width="32" height="32" alt="">
/currency/EUR
/currency/gbp
/currency/yen
/currency/BTC
/currency/ethereum
/currency/USDT?withNetwork=true
/currency/BNB?withNetwork=true

Get the flag of a country

curl 'https://favicon.intami.pl/flag/DE?preferredSize=32'
  • The answer is always an SVG image of the rectangular 4:3 flag (no redirect), preferredSize wide and 3/4 of it high, ready for <img src>; flags from flag-icons (MIT).
  • A round flag is a matter of CSS: img.flag { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }.
  • The country is given by its ISO 3166-1 alpha-2 (DE), alpha-3 (DEU) or numeric (276) code, case-insensitive; EU (European Union) and UN (United Nations) also work.
  • Or by its English name, compared without case, accents and punctuation: germany, United States, usa, ivory-coast; england, scotland, wales and northern-ireland have their own flags.
URL parameterDescriptionHints
countryPath: ISO 3166-1 code or English name of the country, e.g. DE, jpn, 840, united-states.Required. At most 64 characters, URL encoded.
preferredSizeQuery parameter: width of the image in pixels, the height is 3/4 of it.Optional, default 64. A number from 1 to 1024.
fallbackQuery parameter: URL of an image to redirect to when the flag cannot be found.Optional. Absolute http(s) URL, URL encoded.

Responses:

StatusDescription
200 OKThe SVG image of the flag (image/svg+xml) with an ETag.
304 Not ModifiedThe If-None-Match request header matches the ETag of the image.
302 FoundThe flag cannot be found (or fetched) and fallback is given: the Location header contains the fallback URL.
404 Not FoundThe code is not a country (e.g. a continent), the name is unknown or there is no flag of it.
400 Bad RequestEmpty or too long country, invalid preferred size or fallback URL.
502 Bad GatewayThe flag cannot be fetched at the moment.

Example - show the flag in a page:

<img src="https://favicon.intami.pl/flag/DE?preferredSize=32" width="32" height="24" alt="Germany">
/flag/DE
/flag/jpn
/flag/840
/flag/BR
/flag/EU
/flag/scotland
/flag/PL + CSS border-radius

JavaScript library

A small script (favicon.js, no dependencies) that shows favicons and avatars in your page without building the URLs yourself. Mark images with the data-icon-id attribute and the script does the rest: it asks the API for the favicon of the site or the avatar of the email address and, when there is one, puts it into src of the image. When there is no favicon, the image keeps its own src, so it works as a placeholder.

1. Add the script once, e.g. at the end of <head>:

<script src="https://favicon.intami.pl/favicon.js" defer></script>

2. Mark the images:

<img data-icon-id="wikipedia.org" src="default-icon.png" width="32" height="32" alt="">
<img data-icon-id="https://github.com/golang/go" data-preferred-size="32" src="default-icon.png" width="32" height="32" alt="">
<img data-icon-id="john.smith@example.com" data-color="mono" src="default-icon.png" width="32" height="32" alt="">

Attributes and classes:

NameDescriptionHints
data-icon-idThe web site whose favicon is shown: a domain name (wikipedia.org) or any URL of the site (https://www.bbc.com/news?id=1); or the email address whose avatar is shown (john.smith@example.com, also mailto:john.smith@example.com).Required. Only the host name of a URL is used; img elements only.
data-preferred-sizePreferred favicon size in pixels, passed to the API as preferredSize: that size, otherwise the nearest larger one, otherwise the largest one available.Optional, default 64. A number from 1 to 1024; with an invalid value the favicon is missing.
data-colorBackground of an image generated for an email address without an avatar, passed to the API as color: color or mono (black).Optional, default color; with an invalid value the image is missing.
srcImage shown while the favicon is loading and when there is none.Optional. Use your default icon or a transparent image.
class favicon-foundAdded when the favicon was found and set as src.
class favicon-missingAdded when the site has no favicon or data-icon-id is invalid; src is not changed.E.g. img.favicon-missing { display: none; } hides such images.

How it works:

  • The favicon is loaded in the background; src is replaced only when it has loaded, so there are no broken image icons.
  • Images added to the page later (e.g. by AJAX or a JavaScript framework) and changes of data-icon-id, data-preferred-size or data-color are handled automatically.
  • Every site or email address (and size and color) is asked only once per page, even when it is shown many times; the browser caches the answers for a day.
  • The script talks to the server it was loaded from.

Example - hide sites without a favicon:

<style> img.favicon-missing { display: none; } </style>
<a href="https://github.com"><img data-icon-id="https://github.com" width="16" height="16" alt=""> GitHub</a>

Live demo:

github.com
https://en.wikipedia.org/wiki/Favicon
bbc.co.uk
no-such-site-xyz123.com
(no favicon, placeholder stays)
john.smith@example.com
(generated)
john.smith@example.com
data-color="mono"

Try it


API Limits

This API has no request limit.
Found icons, avatars, currency icons, flags and logos are cached for 7 days, missing ones for 1 day, generated avatars for 90 days; responses can be cached by browsers for 1 day and used for another day while they are revalidated (stale-while-revalidate, ETag).


Explore the API