D DevBrainBox

HTML5 Favicon

HTML

What is a favicon?

  • A favicon (short for "favorites icon") is a small icon that represents your website.
  • It appears in the browser tab, bookmarks, and sometimes in the address bar.
  • Typically it’s a 16x16 or 32x32 pixel image in .ico format.

How to add a favicon in HTML4?

In HTML4, the favicon is linked using a <link> tag placed in the <head> section.

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
  • rel="shortcut icon" — HTML4 way of telling the browser this is a favicon.
  • href="favicon.ico" — path to your favicon file.
  • type="image/x-icon" — specifies the MIME type.
HTML VersionTypical Usage
HTML4html <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
HTML5html<link rel="icon" href="favicon.png" type="image/png">

On this page