Skip to content

How to add a favicon to your website

The link tag that goes in your page's head, where to save the icon files, and how to check that a browser has picked the icon up.

Reviewed 15 November 2026

Adding a favicon takes two jobs. Put the icon file on your site, then tell the page where it is. That's all.

Step 1: save the files

  • Make the icon first. Favicon sizes and formats lists what to export.
  • Upload it to your site, in any folder you like. A common choice is the top folder, called the root directory.
  • Note the path. A path is the address of the file on your site, such as /favicon.ico.

The old method needed no HTML at all. Browsers looked for one fixed file, favicon.ico, in a website's root directory1. That still works as a fallback, but there's a catch. If a page lists its own icon, modern browsers will choose the linked favicon instead of the one in the root1.

Step 2: add the link tag

The link goes in the head section of the page. That's the part of the HTML that holds information about the page, not content people read. Wikipedia says the standard way is a link element with a rel attribute in the head section1.

<link rel="icon" href="/favicon.ico">

Breaking that down:

  • link says this line connects the page to another file.
  • rel="icon" says what the file is for. MDN says the most common use of the icon value is the favicon2.
  • href is the path or full address of the file.

Google asks for this tag in the header of your home page3. Google says the URL doesn't need to be on your site. It could sit on a content delivery network, which is a service that stores copies of files in many places3.

Adding more than one icon

Use one link per file. Add a type to say what kind of file it is.

<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="icon" href="/favicon.ico">
  • A browser looks at the media, type and sizes attributes to choose the most appropriate icon2.
  • If several icons are equally appropriate, the last one is used2.

Skip "shortcut"

Older pages often write rel="shortcut icon". MDN says the shortcut link type is non-conforming, ignored, and authors must not use it anymore2. Google still reads it, for historical reasons3. Use plain icon.

The same tag on every page

Put the link on every page, not just the home page. It's easy to do once in a shared page template. Google only looks at the home page for search results3, but visitors can land anywhere.

Phone icons

Phones use a separate file. For the whole website on iOS, Apple says to place a PNG called apple-touch-icon.png in the root document folder4. Details are on the home screen icons page.

A missing file costs something

If there's no favicon.ico, browsers can still ask for one. Wikipedia says that fixed-location check used to lead to slower page loads and unnecessary 404 entries in the server log if the file didn't exist1. A 404 is the "page not found" reply. Having the file, or a link tag, avoids those errors.

Step 3: publish and check

  • Publish the page with the new tag.
  • Open the site in a fresh browser window.
  • Look at the tab.

If it hasn't changed, don't panic. Browsers hold on to old icons. The page on why your favicon isn't showing lists the causes.

For Google search results, patience is needed. Crawling can take anywhere from several days to several weeks3. The search rules get their own page: what Google asks of an icon.

Adding a favicon, start to finishSave the icon files on your siteAdd link tags to the headPublish the changed pageReload and look at the tab
The same four steps apply however your site is built.

References

  1. Favicon, Wikipedia
  2. rel attribute values (HTML attributes), MDN Web Docs, Mozilla
  3. Define a favicon to show in search results, Google Search Central
  4. Configuring Web Applications (Safari Web Content Guide), Apple Developer Documentation Archive