How to Add a Favicon in HTML

March 10, 2026 by Talal khalid

A favicon is the small icon that appears in the browser tab next to your website title. You can add it by placing a <link> tag inside the <head> section of your HTML document.

<link rel="icon" type="image/x-icon" href="/favicon.ico">

Example

<head>
  <title>My Website</title>
  <link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>

Place the favicon file in your website root or adjust the path to match its location.

Note

Modern websites often use PNG favicons as well:

<link rel="icon" type="image/png" href="/favicon.png">
Shares