How to set up a favicon in HTML

A favicon is a small icon that appears on the browser tab or address bar of a website. It helps to identify the website and differentiates it from other tabs. Here’s how to use it in HTML:

First, create your favicon and save it as a .ico file. Then, add the following HTML code to the head section of your webpage:

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

The “rel” attribute tells the browser that this is a shortcut icon. The “type” attribute specifies the file type, in this case, an .ico file. The “href” attribute indicates the path to the favicon on your server.

Here’s an example usage in HTML:

    <title>My Website</title>
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <h1>Welcome to my website!</h1>
    <p>This is some content on my website.</p>

Note that the “href” attribute should point to the location of your actual favicon file.

Here’s an example of a website that effectively uses a favicon: Google

Overall, favicons are a small but important detail that can greatly enhance the user experience on a website.

  Written by: Michael from     01-06-2023     Written in: HTML tutorials


  • Derek says:

    This tutorial was really helpful in guiding me through the process of setting up a favicon in my HTML code . I’ve always wondered how to add this small but important element to my website, and the step-by-step instructions provided here made it really easy to follow along. The explanations were clear and concise, and the code snippets were a great visual aid. Thanks to this article, I now have a professional-looking favicon that adds a nice touch to my website. Highly recommend this guide to anyone looking to enhance their web design skills!

  • Preston says:

    This tutorial was incredibly helpful! I had been struggling for so long to figure out how to set up a favicon on my website, but this guide made it a breeze . The step-by-step instructions were clear and easy to follow, even for someone like me who is not very familiar with HTML. I also appreciated the extra tips and suggestions provided along the way. Now my website looks much more professional with that little icon in the browser tab. Thanks for sharing this valuable information!

Leave a Reply

Your email address will not be published. Required fields are marked *