How To Add Favicon In Html

A favicon, also known as a shortcut icon, website icon, tab icon, or bookmark icon, is a small, iconic image that represents your website. Favicons are most commonly displayed on browser tabs, bookmark lists, search results, and history logs. Adding a favicon to your website not only helps with branding but also makes your site more recognizable to users.

In this tutorial, we will walk you through the simple process of adding a favicon to your HTML page.

Step 1: Create or Choose a Favicon Image

First, you need to create or choose an image to use as your favicon. The most common file formats for favicons are .ico, .png, and .gif. The recommended size for a favicon is 16×16 pixels or 32×32 pixels.

You can create a custom favicon using image editing software like Adobe Photoshop, GIMP, or any other tool that allows you to create or edit images. Alternatively, you can search for free favicon designs online or use a favicon generator to create one.

Step 2: Add the Favicon to Your HTML

Once you have your favicon image ready, follow these simple steps:

  1. Upload the favicon image to the root directory of your website. This is where your index.html file is located.
  2. Add the following line of code to the <head> section of your HTML file, right after the <title> tag:
<link rel="icon" href="favicon.ico" type="image/x-icon">

Replace favicon.ico with the filename of your favicon image if it is not named favicon.ico. Remember to also specify the correct file type for your favicon (e.g., image/png for a PNG file or image/gif for a GIF file).

Step 3: Test Your Favicon

After adding the favicon to your HTML, open your website in a web browser to see your favicon displayed in the browser tab. If the favicon does not appear, try clearing your browser cache or opening your website in a different browser.


Adding a favicon to your website is a simple yet important step in creating a professional and recognizable online presence. By following these steps, you can easily add a favicon to your HTML page and enhance your website’s overall appearance and user experience.