Favicon

On this page 7

A favicon is the small icon that identifies a website in browser tabs, bookmarks, history lists, address bar suggestions and home screen shortcuts. In HTML, it is declared with one or more link elements in the document head, and browsers also look for a file named favicon.ico at the site root when no declaration exists.

The name is short for favorites icon, because the feature first appeared in the bookmarks (Favorites) menu of an early desktop browser. Today the favicon is a small but visible part of brand recognition on the Web: users scanning a row of twenty open tabs locate a site by its icon, not by its truncated title.

How browsers find and load a favicon

A browser discovers a favicon by parsing the link elements in the head of the page and choosing the candidate that best fits the place where the icon will appear. The typical declaration is <link rel="icon" href="/favicon.svg" type="image/svg+xml">, where the rel attribute marks the resource as an icon and the sizes attribute can describe its dimensions.

When a page contains no icon declaration, most browsers send a fallback request to /favicon.ico at the root of the origin. This convention predates any formal specification and explains why server logs show many requests for that file, including 404 errors on sites that never provided it. The favicon is fetched separately from the page, cached aggressively and stored per origin in the browser profile.

The following table lists the link relations and related declarations that influence which icon a platform displays.

DeclarationPurposeMain consumer
rel=”icon”Standard icon for tabs and bookmarksAll modern browsers
rel=”apple-touch-icon”Home screen icon on iOS and iPadOSSafari on Apple devices
rel=”mask-icon”Monochrome pinned tab iconOlder Safari versions
Web app manifest iconsInstall and splash screen iconsProgressive web apps on Android and desktop
/favicon.ico fallbackImplicit icon without markupBrowsers, feed readers, crawlers
Declarations that control site icons

Favicon formats and sizes

The choice of format determines sharpness, file size and compatibility. The original ICO container can hold several bitmaps at different resolutions in one file, which lets a browser pick 16 by 16 pixels for a tab and 32 by 32 pixels for a high-density display. PNG files are simpler to produce, and SVG favicons scale to any size from a single vector file.

An SVG favicon can also contain an embedded prefers-color-scheme media query, so the icon switches colors when the operating system uses a dark theme. Support for SVG icons is broad in current desktop browsers but not universal across Safari versions, which is why most sites still ship a raster fallback.

FormatTypical sizesStrengthsLimitations
ICO16, 32 and 48 px in one fileWidest legacy supportLarger files, awkward tooling
PNG32, 180, 192 and 512 pxSimple, lossless, transparentOne size per file
SVGAny size from one fileSharp at every scale, dark mode supportIncomplete Safari support
WebP or AVIFVariesSmall file sizeInconsistent icon support
Common favicon formats compared

A practical minimum set has converged across the industry: an ICO file of 32 pixels for legacy clients, an SVG icon for modern browsers, a 180 pixel Apple touch icon and 192 and 512 pixel PNG files referenced from the web app manifest. Generating dozens of size variants, as older generator tools did, adds markup without measurable benefit.

How a favicon relates to other HTML head elements

A favicon belongs to the metadata layer of a document, together with the title element and meta tags, but it is declared with a link element rather than a meta tag. The distinction matters because the link element references an external resource that the browser fetches, while a meta tag carries a value inline.

ItemHTML mechanismWhere users see it
FaviconLink element with rel iconTabs, bookmarks, history
Page titleTitle elementTab label, search results
Theme colorMeta tag with name theme-colorMobile browser toolbar
Open Graph imageMeta tag with property og:imageLink previews in social apps
Manifest iconJSON file linked with rel manifestInstalled app launcher
Favicon compared with related head metadata

Search engines also display favicons next to results on mobile and desktop result pages. Google, for example, requires the icon to be a multiple of 48 pixels square, crawlable and representative of the brand; an unsuitable icon may be replaced by a generic globe symbol.

Implementing a favicon correctly

A robust implementation starts with a simple, high-contrast symbol that remains legible at 16 pixels, because detailed logos turn into unreadable blurs at that size. Designers usually reduce the brand mark to a single letter or glyph and test it on both light and dark tab backgrounds.

  1. Place favicon.ico at the site root so the implicit fallback request succeeds.
  2. Declare the SVG icon with rel=”icon” and type=”image/svg+xml” in every page head.
  3. Add an apple-touch-icon of 180 pixels with an opaque background.
  4. List 192 and 512 pixel icons in the web app manifest, including a maskable variant if the site is installable.
  5. Serve icons with long cache lifetimes and change the file name when the design changes.

Cache busting is the step most often forgotten. Browsers keep favicons in a separate icon cache that may survive ordinary cache clearing, so replacing the file under the same name can leave returning visitors with the old icon for weeks. A versioned file name, such as favicon-v2.svg, forces a fresh request.

Common favicon mistakes and their fixes

Most favicon problems come from missing files, wrong paths or stale caches rather than from the image itself. The table below links frequent symptoms to their causes and remedies.

SymptomLikely causeFix
Generic icon in tabsNo declaration and no root ICO fileAdd the link element and root fallback
Old icon persistsBrowser icon cacheRename the file with a version suffix
Blurry icon on retina screensOnly a 16 pixel bitmap suppliedProvide 32 pixel or SVG versions
Black square on iOSTransparent apple-touch-iconUse an opaque background color
404 entries in logsMissing /favicon.icoServe a small ICO file at the root
Favicon symptoms, causes and fixes

Another subtle issue concerns relative paths in single-page applications: a declaration such as href="favicon.svg" resolves differently on nested routes, so the icon disappears on deeper pages. Root-relative paths that begin with a slash avoid this failure.

Stripped to the essentials

A favicon is the tiny picture you see next to a page name in your browser tab. It works like the logo on a shop sign: when many tabs are open, it helps you find the right site at a glance.

The website tells the browser where the picture lives with a short line of code. If that line is missing, the browser guesses a standard file name. The key point is simple: a clear, simple icon makes a site easier to recognize in a crowded tab bar.

Where it is applied

A regional public library redesigned its catalog website and switched to a new logo, but staff kept reporting that the old icon still appeared in their browsers. The web team found that the new image had been uploaded under the same name, favicon.ico, and that browsers were serving the cached version.

The team created a simplified one-letter SVG icon with a dark mode variant, added a 32 pixel ICO fallback and a 180 pixel Apple touch icon, and gave every file a version suffix in its name. They also fixed a relative path that had broken the icon on search result pages deeper in the catalog.

Within a day, staff and patrons saw the new icon on all pages, the server logs stopped recording favicon 404 errors, and the library catalog showed its own icon instead of a generic globe in mobile search results.