DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Browser Tips

How to Set a Favicon in HTML (ICO, PNG, SVG, and Apple Touch Icons)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put the icon file in your deployed website, then reference it from the document <head> with rel='icon':

<head>
  <meta charset='utf-8'>
  <title>Example page</title>
  <link rel='icon' href='/favicon.ico'>
</head>

The href must resolve to the image URL that visitors can request. Use /favicon.ico for a file at the site root, or a path such as /icons/favicon-32.png when the file is in a folder.

The essential favicon tag

A favicon is the small icon browsers associate with a page in tabs, bookmarks and other browser UI. The standard declaration is a <link> element inside <head>; it is not placed in the page body.

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

rel='icon' identifies the linked resource as the current document’s icon. The URL in href is resolved like any other web asset, so filename spelling, directory names and letter case must match the deployed file exactly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Root-relative versus relative paths

  • /favicon.ico starts at the web origin’s root. It works consistently from pages in any directory when the file is published at the root.
  • /images/favicon.png points to the images directory at the root.
  • images/favicon.png is relative to the current document URL. A page at /docs/setup.html would look under /docs/images/.
  • An absolute URL can be used when the icon is hosted on another origin, but that host must be reachable by the browser.

Choose an icon format

ICO, PNG and GIF are common favicon formats. SVG provides a scalable vector resource where the target browser supports it. Declare the MIME type when you want to identify a specific format.

Format Example declaration Best fit Trade-off
ICO <link rel='icon' href='/favicon.ico'> Broad compatibility and a simple root-file setup Raster artwork does not scale like a vector
PNG <link rel='icon' type='image/png' sizes='32x32' href='/icons/favicon-32.png'> Modern raster artwork with an explicit size You may need separate files for different target sizes
GIF <link rel='icon' type='image/gif' href='/icons/favicon.gif'> Sites that already publish a GIF icon Browser support and behavior can vary by implementation
SVG <link rel='icon' type='image/svg+xml' sizes='any' href='/icons/favicon.svg'> Scalable vector artwork Support is not universal, so keep a compatible fallback when needed

MDN describes 16×16 pixels as a typical favicon convention. The important rule is that every declared sizes value must describe the actual resource you publish; use any for a scalable SVG resource.

Declare multiple browser variants

You can publish more than one icon link. Browsers use media, type and sizes as selection hints, then choose the most appropriate supported resource.

<head>
  <meta charset='utf-8'>
  <title>Example page</title>
  <link rel='icon' href='/favicon.ico'>
  <link rel='icon' type='image/png' sizes='32x32' href='/icons/favicon-32x32.png'>
  <link rel='icon' type='image/svg+xml' sizes='any' href='/icons/favicon.svg'>
</head>

The ICO line supplies a compatibility-oriented fallback, while the PNG and SVG lines advertise more specific alternatives. Do not declare a size that the file does not actually contain. If you use a media condition for a variant, check that the condition is intentional and that another usable icon remains available when it is false.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add an Apple home-screen icon separately

Apple devices use the apple-touch-icon convention for icons saved to a home screen or web clip. It is separate from the browser favicon declaration and does not replace rel='icon'.

<link rel='apple-touch-icon' sizes='180x180' href='/icons/apple-touch-icon.png'>

Include this line in the same <head> as your browser icon links when iPhone or iPad home-screen behavior matters. Keep the paths and declared dimensions aligned with the files you publish.

Put the file in the deployed build

  1. Create the asset. Export an ICO, PNG, GIF or SVG file. If you publish raster variants, record each file’s pixel dimensions so the sizes attributes are accurate.
  2. Choose a public location. Put favicon.ico at the site root for the simplest path, or place named variants in a public icons directory.
  3. Add the link in the document head. Copy the appropriate declaration into the HTML template used by every page that should have the icon.
  4. Build and deploy. Confirm the icon file is included in the final output, not just present in a local source directory.
  5. Verify the URL directly. Open the exact href address in a browser. It should return the image itself, not an HTML error page, redirect loop or application fallback document.

Browsers may request /favicon.ico automatically when no explicit icon link exists. An explicit declaration is clearer, allows non-ICO formats and documents where your asset lives.

Rank #2
Basics Fashion Design 03: Construction
  • Used Book in Good Condition

How browsers choose among declarations

When several links are present, the browser filters resources it cannot use, considers the advertised MIME type and media condition, and compares available sizes. Supplying accurate hints gives it a better choice without requiring script.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use type='image/png', type='image/svg+xml' or another correct MIME type when declaring a specific format.
  • Use a space-separated list such as 16x16 32x32 when one resource contains those raster sizes.
  • Use sizes='any' for a scalable vector resource such as SVG.
  • Keep at least one broadly compatible fallback if your audience includes browsers with limited SVG support.

Why a favicon is not showing

1. The link is outside <head>

Move the element into the document head. A link in the body is not the standard favicon declaration.

2. The URL is wrong

Copy the href URL into the address bar. A 404 response, an unexpected redirect or an HTML error page means the browser never received a usable icon. Check leading slashes, folder names, hyphens and file-name case; case-sensitive hosting treats Favicon.ico and favicon.ico as different files.

3. The asset was not deployed

Inspect the generated or published site rather than only the source tree. Static hosts and build tools can exclude files that are not in the configured public directory.

4. The format or MIME type is incorrect

Ensure the response’s content is the declared image format and that the server sends a supported MIME type. Remove a misleading type value or correct the server configuration if they disagree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Multiple declarations conflict

Review every icon link. Check each type, sizes and media value, and remove stale links pointing to missing files. A browser can choose a different valid resource than the one you were editing.

6. The browser is using a cached icon

Hard-refresh the page, open a private window or clear the browser’s cached site data, then test again. Replacing an icon does not guarantee that every browser will request the new bytes immediately.

7. You are testing the wrong feature

A browser tab favicon and an iPhone or iPad home-screen icon use different conventions. Add apple-touch-icon for the latter and test it through the device’s home-screen flow.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A compact production head

This example covers a root fallback, explicit PNG and SVG variants, and an Apple home-screen icon:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<head>
  <meta charset='utf-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1'>
  <title>Your page</title>
  <link rel='icon' href='/favicon.ico'>
  <link rel='icon' type='image/png' sizes='32x32' href='/icons/favicon-32x32.png'>
  <link rel='icon' type='image/svg+xml' sizes='any' href='/icons/favicon.svg'>
  <link rel='apple-touch-icon' sizes='180x180' href='/icons/apple-touch-icon.png'>
</head>

Use only the lines you actually support. A single correctly deployed ICO or PNG is enough for a basic browser favicon; the additional declarations serve different formats, sizes or device targets.

Or skip the browser setup

If your goal is to inspect the finished page visually without installing browser automation, ScreenshotNeo is a website screenshot API and MCP server. It does not replace the favicon link or host your icon; it gives you a rendered capture after you deploy the page so you can check the result remotely. The API accepts one GET request and can return PNG, JPEG or WebP.

See the ScreenshotNeo documentation for all parameters. A complete cURL request is:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://freedom251.com -o shot.webp

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://freedom251.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://freedom251.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

What the service handles

  • It accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Each cleanup step can be turned off.
  • Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing; response headers identify the page verdict and whether it was billed with X-Page-Verdict and X-Billed.
  • An MCP server provides take_screenshot, get_page_info and capture_pdf tools to Claude, Cursor and other MCP clients.
  • For favicon QA, you can request a full-page capture, choose a device preset or viewport, set retina scale, wait for a selector or network idle, and hide elements that obscure the page. The service also supports custom CSS and JavaScript, headers, cookies, user agents, authorization, timezone and geolocation.

Plans

Plan Allowance Price
Free 1,000 shots per month $0, no card
Starter 3,000 shots $5
Growth 15,000 shots $15
Pro 60,000 shots $39
Scale 250,000 shots $99
Business 1,000,000 shots $249

Every feature is available on every plan, and yearly billing gives two months free. When you are ready to check a deployed favicon without setting up a browser, create a free ScreenshotNeo account and start with 1,000 screenshots a month without a card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Do I need rel=’shortcut icon’ instead of rel=’icon’?

No. The standard declaration is <link rel='icon' ...>. Use it in the document head and point href at the deployed image.

Can one favicon declaration cover every device?

It can cover ordinary browser favicon use, but Apple home-screen behavior uses the separate apple-touch-icon convention. Add that resource when home-screen icons are part of your target.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.