How To Add a Favicon in HTML

How to add an icon logo in the title bar using HTML?

To add an icon (favicon) to the title bar of a web page, you can use the <link> element with the rel attribute set to "icon" in the <head> section of your HTML document. Here’s how you can do it:

  1. Prepare the favicon image: Create an image file that you want to use as the favicon. Commonly, the favicon image is a square image with dimensions like 16×16 pixels or 32×32 pixels.
  2. Upload the favicon image: Upload the favicon image to your web server or hosting service.
  3. Add the favicon link: In the <head> section of your HTML document, add the following line inside the <head> tags, replacing "favicon.ico" with the actual path to your favicon image:
<link rel="icon" href="path-to-your-favicon/favicon.ico" type="image/x-icon">

If you have jpg or png or any type of image file, you can easily convert them to a .ico file using ICO Converter.

Here’s an example of how the complete HTML code might look with the favicon link added:

<!DOCTYPE html>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Website</title>
  <!-- Add the favicon link here -->
  <link rel="icon" href="path-to-your-favicon/favicon.ico" type="image/x-icon">
  <!-- Your content here -->

Make sure to replace "path-to-your-favicon/favicon.ico" with the actual path to your favicon image.

Note that different browsers may support various image formats for favicons, such as ICO, PNG, GIF, and JPEG. For best compatibility, you can create and use a favicon in the ICO format, which is a standard format for favicon images.

Saroj Meher
Saroj Meher
Howdy! Friends, I am Saroj Meher. I am an Artist. I do Painting on mediums like Acrylic, Watercolour, Oil etc. I have over 7 years of experience in WordPress. I am currently running 30+ website. I am specialized in WordPress and WooCommerce, WordPress Theme Customization and Theme Development. I can fix any kind of WordPress error/issue like PHP, CSS, Js issues and other Theme and Plugin related issues. Client's Satisfaction is my first priority.

Subscribe For More!

Subscribe to get the Latest Updates directly in you Email box.

Explore More


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I am a Lecturer (English & Sociology), a professional Artist, and a blogger. I do painting, sketches since my childhood. I am in the teaching for 10 years. In this teaching line, I have experience in teaching English at High School and College levels. I have also experienced teaching computer theory during the school teaching period. This is my personal web corner over the internet.

Quick Guides

7 Simple Steps To Start Your Blogging Journey