Link

icon

Provides an icon that browsers can use for the page in tabs, bookmarks, history, and other interface surfaces.

Code examples

Good example
<link rel="icon" href="/icon.svg" sizes="any" type="image/svg+xml">
Declares a scalable SVG icon with its MIME type.
Good example
<link rel="icon" href="/icon-192.png" sizes="192x192" type="image/png">
Declares the actual dimensions and type of a PNG icon.
Avoid this example
<link rel="icon" href="/icon-32.png" sizes="192x192">
Claims a size the linked bitmap does not contain, which can make the browser choose the wrong candidate.

Recommendations

  • 01
    Describe each candidate
    When you provide several icons, set sizes, type, or media accurately so the browser can choose the best match.
  • 02
    Use any for scalable icons
    For SVG, use sizes="any" and type="image/svg+xml". Bitmap size tokens must match dimensions that the file actually contains.
  • 03
    Version changed files
    Browsers cache site icons aggressively. A new filename is more reliable than replacing an existing file in place.

Related documentation