A favicon is the small brand icon browsers show in tabs and bookmarks. In HTML you declare it inside <head> with <link rel="icon" href="…">, optionally with sizes and type. Add rel="apple-touch-icon" for iOS home-screen icons.
What is a favicon for in an HTML tutorial?
Help users recognize your site among many tabs. A clear icon reinforces brand and reduces mix-ups.
Where does the link go?
Only in <head>, alongside title, charset, and stylesheets. The icon file itself lives on your server (often /favicon.ico or /images/favicon.png).
When should you add one?
As soon as the site has a public URL. Even a simple 32×32 PNG improves polish. Ship multiple sizes when you care about high-DPI tabs and home-screen installs.
Always in head.
Favicon <link> elements belong in <head>, not in <body>.
Caching is aggressive.
Browsers cache favicons hard. After replacing a file, bump the query string (?v=2) or rename the asset to force a refresh.
Root fallback.
Many browsers still request /favicon.ico automatically. Providing that file avoids 404 noise in logs.
Serve real files at those paths for the icons to appear.
Edge Cases & Pitfalls
Missing icons are usually wrong paths, stale cache, or links placed outside head.
path
Relative path breakage
On nested URLs, favicon.ico without a leading / may 404. Prefer root-absolute paths.
cache
Stale favicon cache
Tabs keep old icons. Version the file (?v=3) after updates.
body
link in body
Invalid placement. Move favicon links into head.
type
Wrong MIME type
Server must serve PNG as image/png, SVG as image/svg+xml.
square
Non-square artwork
Browsers may crop oddly. Design on a square canvas.
404
Missing /favicon.ico
Automatic requests still happen. Add a root ICO or accept log noise.
Compatibility
Browser Support
link rel=icon is universal; SVG favicons and apple-touch-icon are widely supported on their target platforms.
✓ Baseline · Widely available
HTML favicons
Every browser that shows tabs can load an icon declared in head.
100%rel=icon
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
Favicon linkUniversal
Bottom line: Declare rel=icon (and apple-touch-icon) in head, set sizes/type when needed, and keep a root favicon.ico fallback.
Remember
Key Takeaways
<link rel="icon"> in head sets the tab icon.
sizes and type help when you ship several bitmaps.
apple-touch-icon covers iOS home-screen installs.
Cache bust after replacing icon files.
One line: Put <link rel="icon"> (plus sizes/type and apple-touch-icon as needed) in <head> so tabs and home screens show your brand.
Frequently Asked Questions
A favicon is the small site icon shown in browser tabs, bookmarks, and some history lists. You declare it in the document head with a link element such as rel="icon".
Inside <head>, usually near other metadata. Browsers discover icons early while parsing head.
sizes tells the browser the pixel dimensions of that icon file (for example 32x32). It helps pick the best match when you offer several icons.
rel="apple-touch-icon" points to an image (often 180×180 PNG) used when someone adds your site to an iOS home screen.
Many sites still place /favicon.ico at the site root because browsers and crawlers look there by default. Prefer also declaring link rel=icon for modern PNG or SVG icons.
Yes in modern browsers: <link rel="icon" href="/favicon.svg" type="image/svg+xml">. Keep a PNG or ICO fallback for older clients.