HTML Favicon

How To Add a Favicon in HTML

A favicon is a small icon that appears in the browser tab or bookmark bar of a website. It is a visual representation of the website and helps users identify the site easily. Here is an example of how to add a favicon in HTML:

  1. Create a 16×16 pixel image that you want to use as your favicon. Save the image in the PNG, GIF or ICO format.
  2. Upload the image to your website’s root directory.
  3. In the head section of your HTML document, add the following code:
<link rel="icon" type="image/png" href="/favicon.png">

Note that the href attribute should point to the location of your favicon file on the server.

Here is an example of how the complete HTML code should look:

<!DOCTYPE html>
<html>
<head>
    <title>My Website</title>
    <link rel="icon" type="image/png" href="/favicon.png">
</head>
<body>
    <!-- Your website content goes here -->
</body>
</html>

That’s it! Save the HTML file and upload it to your server. Your favicon should now appear in the browser tab and bookmark bar.

Scroll to Top