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

Put a <link rel="icon"> element in your document’s <head>, and set href to the public URL of your icon file:

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

The leading slash means “from the website root.” If your deployed file is somewhere else, use the URL path that actually serves that file. An explicit link is the dependable way to declare an icon, even though browsers may also look for /favicon.ico automatically.

What the favicon link does

A favicon is the small page icon shown in browser tabs, bookmarks and other browser UI. It is not visible content, so place its declaration inside the page’s <head>, not in the <body>. The rel="icon" value identifies the relationship, while href points to the image resource. MDN documents this pattern in its web-page metadata guide.

Minimal ICO example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My site</title>
  <link rel="icon" href="/favicon.ico">
</head>
<body>
  <h1>Welcome</h1>
</body>
</html>

This works when a file named favicon.ico is served at the domain root—for example, https://example.com/favicon.ico.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Amazon Basics Wired QWERTY Keyboard, Works with Windows, Plug and Play, Easy to Use with Media Control, Full-Sized, Black
  • KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
  • EASY SETUP: Experience simple installation with the USB wired connection
  • VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
  • SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
  • FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.

Choose the correct file path

The URL in href is resolved by the browser against your deployed site. A root-relative path starts with /; a relative path is resolved against the current document’s directory.

File location on the deployed site HTML What it means
Site root /favicon.ico Requests https://your-domain.example/favicon.ico.
Public images directory /images/favicon.png Requests the file from the root-level images directory.
Same directory as the current HTML document favicon.png Uses a path relative to that document’s URL.
Absolute URL on a permitted host https://cdn.example/favicon.svg Loads the icon from the specified origin.

Many frameworks expose a reserved public or static folder at the site root. In that setup, a source file such as public/favicon.png is commonly referenced as /favicon.png, not /public/favicon.png. Confirm the URL in the deployed page rather than relying on the source-folder name.

Use PNG, SVG or ICO correctly

For a single raster icon, an explicit PNG declaration is straightforward:

<link rel="icon" href="/favicon.png" type="image/png">

The type attribute is a hint about the resource’s MIME type. The server should still send an appropriate Content-Type, such as image/png for PNG. ICO remains a convenient choice for a root favicon, while PNG and SVG make the format explicit. SVG is scalable, but support and selection can vary by browser and context; provide a raster fallback when your audience includes older or constrained clients.

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.
Rank #2
Sale
Logitech MK270 Full Size Wireless Keyboard and Mouse Combo - Black
  • Reliable Plug and Play: The USB receiver provides a reliable wireless connection up to 33 ft (1), so you can forget about drop-outs and delays and you can take it wherever you use your computer
  • Type in Comfort: The design of this keyboard creates a comfortable typing experience thanks to the low-profile, quiet keys and standard layout with full-size F-keys, number pad, and arrow keys
  • Durable and Resilient: This full-size wireless keyboard features a spill-resistant design (2), durable keys and sturdy tilt legs with adjustable height
  • Long Battery Life: MK270 combo features a 36-month keyboard and 12-month mouse battery life (3), along with on/off switches allowing you to go months without the hassle of changing batteries
  • Easy to Use: This wireless keyboard and mouse combo features 8 multimedia hotkeys for instant access to the Internet, email, play/pause, and volume so you can easily check out your favorite sites

Declaring several candidates

You can provide alternatives and let the user agent select a suitable one. The HTML standard describes sizes as advisory metadata, and any can indicate a scalable resource. Declare dimensions that the file actually contains:

<link rel="icon" href="/favicon.svg" type="image/svg+xml" sizes="any">
<link rel="icon" href="/favicon-32.png" type="image/png" sizes="32x32">
<link rel="icon" href="/favicon-16.png" type="image/png" sizes="16x16">

Browsers use information such as media, type and sizes when choosing among icon links. They may try another suitable candidate if one cannot be used. This behavior is selection guidance, not a promise that every browser chooses the same file. See MDN’s rel reference and the HTML Standard’s links section.

Favicon versus Apple home-screen icons

A browser-tab favicon and an icon used when someone adds a website to an Apple home screen are separate declarations. If you need the latter, add an apple-touch-icon link as well:

<link rel="apple-touch-icon" href="/apple-touch-icon.png">

Apple touch icons are a platform convention; adding one does not replace the regular rel="icon" declaration. MDN’s metadata examples include touch-icon links and optional size information.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
  • All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
  • Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
  • Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
  • Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
  • Plastic parts in K120 include 51% certified post-consumer recycled plastic*

How to add it step by step

  1. Create the image. Use a simple, recognizable mark that remains legible at tab size. Export the format and dimensions you intend to serve.
  2. Put it in the public asset location. Copy it to the site root or the framework’s publicly served directory. Do not point to a source-only path that is unavailable after deployment.
  3. Add the link in every document that needs it. Insert <link rel="icon" ...> inside <head>. A shared layout or base template is usually the safest place.
  4. Set accurate metadata. Match type to the actual format and sizes to the resource. Use sizes="any" for a scalable icon such as SVG when appropriate.
  5. Deploy and inspect the final URL. Open the exact href in a new browser tab. It should return the image rather than a 404 page, redirect loop or HTML document.
  6. Reload the page. Favicons are cached aggressively. Test in a private window or clear the site’s cached data if an old icon remains.

Common failures and fixes

The link is in the wrong place

Symptom: The markup appears in the body or in a component that is not emitted into the document head. Fix: View the rendered page source or DOM and confirm the link is inside <head>, then move it into the document template or head-management API used by your framework.

The path works locally but not after deployment

Symptom: Development shows the icon, while production returns 404. Fix: Request the production href directly. Adjust for a subpath deployment, base URL or asset-prefix setting. A root-relative /favicon.ico points to the domain root, not necessarily the folder where an application is mounted.

The server returns the wrong content

Symptom: The URL returns an HTML error page, a download, or an incorrect MIME type. Fix: Check the response status and Content-Type; serve the actual image with an image MIME type and ensure rewrites do not send your app shell for the icon path.

The declared type or size does not match

Symptom: One candidate is ignored or a fallback appears. Fix: Correct type and sizes to describe the file that is really delivered. Do not label a PNG as SVG or claim dimensions that are not present.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Redragon K521 Upgrade Rainbow LED Gaming Keyboard, 104 Keys Wired Mechanical Feeling Keyboard with Multimedia Keys, One-Touch Backlit, Anti-Ghosting, Compatible with PC, Mac, PS4/5, Xbox
  • 【Dreamy Rainbow Gaming Keyboard】K521 Gaming Keyboard Adopts a Different LED Backlight Design, Upgraded on the Traditional LED Backlight Effect, Making the Light More Penetrating, Giving You a More Dazzling Visual Effect, Making Your Gaming Process More Enjoyable
  • 【One Touch Opens & Visual Feast】The K521 Red Dragon Keyboard has a One-Touch on/off Lighting Button for Added Convenience. It also has a Three-Position Adjustable Breathing Mode and a Four-Position Adjustable Brightness Lighting Mode
  • 【Mechanical Feeling & Fast Tapping】The PC Keyboard Keys are Designed for Mechanical Feeling, Giving You a Better Feel During Use and the Ability to Trigger Keys Quickly, Allowing You to Win All Your Games
  • 【19 Keys Anti-Ghosting Keyboard】Anti-Ghosting Ensures Every Button Can Be Triggered. This Allows You to Trigger Key Combinations In The Game Accurately, And Each Skill Can Be Accurately Released to Increase Your Winning Rate. Redragon K521 Will Be Your Perfect Partner
  • 【12 Multimedia Combination Keys】The K521 Wired Gaming Keyboard is Equipped with 12 Multimedia Keys That Can Greatly Enhance Your Gaming/Office Efficiency and Make It More Convenient to Use

The old favicon is still visible

Symptom: Source is correct, but the tab keeps showing an earlier image. Fix: Favicons are cached separately from ordinary page content. Test in a private window, perform a hard reload, or clear the site’s cached resources. Change the file URL (for example, from /favicon.png to /favicon-v2.png) only when you can update every reference consistently.

The icon is visible in a tab but not on a phone home screen

Symptom: The tab icon works, but an installed web shortcut uses a generic image. Fix: Add the platform-specific apple-touch-icon declaration and any separately required web-app manifest icons. Those are different targets from the favicon.

Root fallback and explicit markup

Most browsers and other software automatically look for a site-root favicon.ico. The HTML standard says user agents may fetch /favicon.ico when no icon link is present. Treat that as a fallback, not as a substitute for correct markup: an explicit link documents your intent, supports non-root files and lets you offer format and size alternatives.

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

Performance and maintenance checklist

  • Keep the icon small enough that it does not delay the first page request.
  • Serve it from a stable, cacheable URL and update the URL when you intentionally replace the asset.
  • Use a high-contrast design that survives reduction to roughly tab-sized artwork.
  • Verify every declared candidate in production, including its status code and MIME type.
  • Keep favicon links in the shared head template so new pages do not silently omit them.
  • Do not use rel="shortcut icon" as the recommended form. MDN identifies shortcut as non-conforming; use rel="icon" instead.

Or skip the browser setup

If your real task is obtaining a clean screenshot of a page—including its tab context for documentation or QA—ScreenshotNeo can capture the rendered URL through one request. It removes cookie-consent banners, newsletter popups and chat widgets before capture; bot checks, blank pages and failed loads are not billed; and its MCP server lets AI agents such as Claude or Cursor take screenshots. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000.

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

cURL:

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

Python:

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

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for options such as full-page capture, device presets, custom CSS, waits and PDF output. Create a free ScreenshotNeo account to get 1,000 screenshots each month without adding a card.

Best Value
Sale
Logitech K270 Full Size Wireless Keyboard for Windows - Black
  • All-day Comfort: This USB keyboard creates a comfortable and familiar typing experience thanks to the deep-profile keys and standard full-size layout with all F-keys, number pad and arrow keys
  • Built to Last: The spill-proof (2) design and durable print characters keep you on track for years to come despite any on-the-job mishaps; it’s a reliable partner for your desk at home, or at work
  • Long-lasting Battery Life: A 24-month battery life (4) means you can go for 2 years without the hassle of changing batteries of your wireless full-size keyboard
  • Simply plug the USB receiver into a USB port on your desktop, laptop or netbook computer and start using the keyboard right away without any software installation
  • Simply Wireless: Forget about drop-outs and delays thanks to a strong, reliable wireless connection with up to 33 ft range (5); K270 is compatible with Windows 7, 8, 10 or later

Quick verification checklist

  • The rendered document contains a rel="icon" link inside <head>.
  • The href URL is the deployed location, not merely the source-folder path.
  • Opening that URL returns the intended image with a successful status.
  • type and sizes accurately describe each candidate.
  • Any Apple home-screen requirement has a separate apple-touch-icon link.
  • You tested after accounting for favicon caching.

Frequently Asked Questions

Do I have to name the file favicon.ico?

No. Any publicly served image filename works when the href points to it. The name favicon.ico matters mainly because browsers may request that root fallback automatically.

Can I put the favicon link in the body?

Put it in <head>. That is where document metadata links are declared and where browsers expect the icon relationship.

Is shortcut icon required for compatibility?

No. Use the conforming rel="icon" form; MDN advises against the non-conforming shortcut token.

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

Quick Recap

Bestseller No. 1
SaleBestseller No. 3
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Plastic parts in K120 include 51% certified post-consumer recycled plastic*; Product carbon footprint: 4.02 kg CO2e
$12.34
SaleBestseller No. 5
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Plastic parts in K270 include 38% certified post-consumer recycled plastic; Eight hot keys: For instant access to the Internet, e-mail, music volume and more
$21.48

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.