A favicon (short for favourite icon) is a small image displayed next to the page title in the browser tab. It helps users identify your site quickly among many open tabs.
The favicon appears in:
Add a <link> tag inside the <head> section of your HTML page:
<head>
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
The favicon file should be placed in the root folder of your website (same level as your homepage).
favicon.ico in the root folder even without a <link> tag, but it is best practice to always declare it explicitly.
| Format | Type | Support |
|---|---|---|
.ico |
image/x-icon |
All browsers — most compatible |
.png |
image/png |
All modern browsers |
.svg |
image/svg+xml |
Modern browsers only |
.gif |
image/gif |
Limited support — avoid |
PNG is widely supported and easier to create than ICO files:
<link rel="icon" href="favicon.png" type="image/png">
For full device support (including iOS home screen and Android), declare multiple sizes:
<!-- Standard favicon -->
<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- PNG for modern browsers -->
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<!-- Apple touch icon (iOS home screen) -->
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
SVG favicons scale perfectly at any size and can even support dark mode:
<link rel="icon" href="favicon.svg" type="image/svg+xml">
You can create a favicon in several ways:
.ico format online| Use Case | rel attribute | Recommended Size |
|---|---|---|
| Browser tab icon | icon |
32×32 or 16×16 px |
| iOS home screen | apple-touch-icon |
180×180 px |
| Android home screen | icon |
192×192 px |