The Wayback Machine - https://web.archive.org/web/20240806123323/https://www.geeksforgeeks.org/html-favicon/
Open In App

HTML Favicon

Last Updated : 22 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report

HTML Favicon is a small icon representing a website, appearing in the browser’s tab or bookmark bar. Defined using the <link> tag with `rel=”icon”`, it is also known as the Favorite icon. Additional keywords include HTML icon, browser icon, and bookmark icon.

List of Favicon Sizes

Name

Size

Description

favicon-32.png

32×32

Standard for most desktop browsers.

favicon-57.png

57×57

Standard iOS home screen.

favicon-76.png

76×76

iPad home screen icon.

favicon-96.png

96×96

GoogleTV icon.

favicon-120.png

120×120

iPhone retina touch icon.

favicon-128.png

128×128

Chrome Web Store icon & Small Windows 8 Star Screen Icon*.

favicon-144.png

144×144

Internet Explorer 10 Metro tile for pinned site*

favicon-152.png

152×152

iPad touch icon.

favicon-167.png

167×167

iPad Retina touch icon (change for iOS 10: up from 152×152, not in action. iOS 10 will use 152×152)

favicon-180.png

180×180

iPhone 6 plus

favicon-192.png

192×192

Google Developer Web App Manifest Recommendation

favicon-195.png

195×195

Opera Speed Dial icon

(Not working in Opera 15 and later)

favicon-196.png

196×196

Chrome for Android home screen icon

favicon-228.png

228×228

Opera Coast icon

Steps to create Favicons

  • Create a small square image (e.g., 16×16 pixels or 32×32 pixels) to serve as your favicon. Save it in a suitable format like PNG, GIF, or ICO.
  • Save the image with a suitable filename, such as “favicon.png” or “favicon.ico”.
  • Upload the favicon image to your website’s server or hosting directory.
  • In the <head> section of your HTML document, add the following code
<link rel="icon" type="image/png" href="path-to-favicon">

Example of HTML Favicon

Adding Favicon to the web page

In this approach, we are following below the mentioned points

  • Use <link> tag in <head> section.
  • Set rel=”icon” to specify the link type as icon.
  • Define href attribute to provide the URL of the favicon image.
  • Optionally, set the type attribute to specify the image type.

Syntax

<link rel="icon" type="image/png" href="path-to-favicon">

Example: In this example we sets a favicon for a webpage using a link element with the “rel” attribute set to “icon” and the “href” attribute pointing to the favicon image. The favicon appears in the browser tab.

HTML
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>HTML Favicon</title>
  
    <!-- Add icon link -->
    <link rel="icon" href=
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200X200.png" 
          type="image/x-icon">
</head>

<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <p>Welcome to my website</p>
</body>

</html>

Output:

favicon

Note: Major browsers are not supported by the sizing property of the favicon.

Many web browsers display the favicons on the left side of the address bar, so they are often used as a part of a phishing attack on HTTPS pages. The attacker changes the favicon of the site to the familiar padlock sign (notifying an encrypted connection) to fool the users. To circumvent this, many popular and modern web browsers display the favicon in the tab only and display the security status of the protocol used to access the website beside the URL.

HTML Favicon – FAQs

What is a favicon?

A favicon is a small icon that represents a website, typically displayed in the browser tab, bookmarks, and address bar.

How to add a favicon to an HTML document?

Use the <link> tag inside the <head> section of the HTML document. Example: <link rel=”icon” href=”favicon.ico” type=”image/x-icon”>

What file formats are commonly used for favicons?

Common formats include .ico, .png, .svg, and .gif.

Where should the favicon file be placed?

The favicon file is typically placed in the root directory of the website, but it can be located anywhere as long as the path in the <link> tag is correct.

Can you use a PNG file as a favicon?

Yes, use the <link> tag with the type attribute set to image/png. Example: <link rel=”icon” href=”favicon.png” type=”image/png”>

How do you specify multiple favicon sizes?

Use the sizes attribute in the <link> tag. Example: <link rel=”icon” href=”favicon-32×32.png” sizes=”32×32″>



Previous Article
Next Article

Similar Reads

What is favicon and what is the size of it in HTML?
A favicon is something that all of us see daily while browsing the web, but many of us don't observe it or pay any need to it. A favicon goes by many other names as well, some of them being the favorite icon (hence the acronym favicon), shortcut icon, tab icon, website icon, or bookmark icon. It is the little image we see on a tab, or while making
3 min read
How to add a browser tab icon (favicon) for a website ?
A browser tab icon, also known as a favicon is a small image that appears before the title of a webpage in the browser tab or bookmark bar to represent a website. It helps in brand recognition, improves user experience, and makes the website stand out among others. Adding a favicon can help users easily identify your website and differentiate it fr
2 min read
How to add favicon to a static page ?
What is a favicon? A favicon, short for "favorite icon," is a small icon or image that is associated with a website. It appears in the browser's address bar, next to the page title, in browser tabs, and in bookmark lists. Favicons were introduced in the late 1990s by Microsoft Internet Explorer, and they have since become a common feature of modern
3 min read
How to Change the Favicon in React JS?
Changing the favicon in a React JS application involves a simple process to customize the default icon displayed in the browser tab. The favicon, a small image typically in the .ico format, serves as a visual identifier for the website. In this article, we will explore the following two different methods for changing the favicon in a React JS appli
4 min read
How to Use Animation on Favicon Image?
A favicon is a special icon that appears at the top left corner near the web address bar. The file type can be any jpg, png, gif, or icon(.ico) image. The default favicon name is favicon.ico. The favicons are also commonly known as shortcut icons, bookmark icons, or website icons. They provide convenience to users for locating your web page. An ani
5 min read
What is the use of serve favicon from Node.js Server ?
A favicon is a small icon displayed in a browser's tab, next to the page title, bookmarks, and address bar. Despite its size, a favicon plays a significant role in branding and enhancing user experience by making web applications easily recognizable and improving their visual appeal. Serving a favicon from a Node.js server is essential for modern w
3 min read
How to Change Favicon Dynamically?
You may probably notice that many social networks and modern web applications have dynamic favicons. Dynamic favicons may be for different purposes, for example, social networks use it to display notifications or messages. Some websites also have the percentage-based favicon that tracks the levels of success, and if you complete a level, the favico
2 min read
How to add Favicon in WordPress ?
Adding a favicon to your WordPress site is a small yet significant step to enhance your site's branding. A favicon, short for "favorite icon," is the small image that appears next to your site’s name in browser tabs, bookmarks, and other areas. It helps users easily identify your site among many open tabs and saved bookmarks. Understanding FaviconB
4 min read
How to Return /favicon.ico as req.url in ExpressJS ?
In ExpressJS, handling the /favicon.ico request URL is a common requirement to serve a favicon (icon displayed in the browser tab) for your website. Here's how you can return /favicon.ico as req.url in ExpressJS Below are the approaches mentioned to return /favicon.ico as req.url: Table of Content Using express.staticUsing Explicit Route HandlingSt
3 min read
How to Add a Favicon to a Next.js Static Website?
To add a favicon to a next.js static website we can utilize the public directory of our next js project. A favicon is a small icon that appears in the browser tab next to the page title. It helps users identify your website easily. In this article, we'll explore different approaches to adding a favicon to a Next.js static site. Here are 2 approache
3 min read
three90RightbarBannerImg