How to add a site icon in HTML
To add a site icon in HTML, upload the icon file to your site and put <link rel="icon" href="/favicon.ico"> inside the <head> of your pages. Browsers then show it in tabs and bookmarks, and Google can show it next to your site in search results.
Favicon generatorUpdated 4 min read
A site icon and a favicon are the same thing. The steps below cover a hand-built site first, then WordPress.
Add a favicon to an HTML site
- Make the files. The generator further down gives you
favicon.ico, PNGs at 16, 32, 180, 192 and 512 pixels, and asite.webmanifestfile, in one zip. - Upload them to the root folder of your site, the same folder as your home page, so they load at addresses like
https://example.com/favicon.ico. - Paste these tags inside the
<head>of every page. If your site uses a shared header or layout file, paste them there once.
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">- Publish, then open your site in a private window to see the icon.
The first line is the one Google's documentation uses. The PNG lines give browsers sharper choices: when there are several rel="icon" links, MDN says the browser picks one from their type, sizes and media. The apple-touch-icon line is for iPhones and iPads, which don't use rel="icon" for Home Screen icons. The manifest line points Android and Chrome to the 192 and 512 pixel icons.
Use rel="icon", not rel="shortcut icon". MDN says shortcut is non-conforming and authors shouldn't use it any more.
Favicon generator
Open the full toolThe shortest version that works
If you only want one file, put favicon.ico in your root folder. MDN notes that browsers request /favicon.ico on their own, and Apple's guide says iOS looks for /apple-touch-icon.png in the same way. Linking them explicitly is still better, because it protects you if those conventions change, and Google needs a link tag on your home page to pick up the icon for search results.
Add a site icon in WordPress
WordPress has its own Site Icon setting, and its documentation recommends using it instead of editing theme files. You don't need the HTML tags.
In WordPress 6.5 or later:
- Upload a square image of at least 512 × 512 pixels to the Media Library. PNG is the recommended format; from the generator's zip, use
android-chrome-512x512.png. - Go to Settings, then General.
- Click Choose a Site icon and select the image.
In WordPress 4.3 to 6.4:
- Go to Appearance, then Customize.
- Click Site Identity.
- Under Site Icon, click Select Image, then upload your square image of at least 512 pixels.
Favicon not showing?
Work through these in order:
- Open the icon directly. Visit
https://yoursite.com/favicon.icoin your browser. If you get an error page, the file isn't where the tag says it is. - Check the tag's place and path. The
<link>must sit inside<head>, not in the body. A path starting with/means the site root; without it, the browser looks next to the current page. - Clear the old icon. Browsers keep favicons for a long time. Open the site in a private window, or clear the browser's cache.
- Give Google time. Google says picking up a new favicon can take from several days to several weeks. The icon must be square, linked from your home page and not blocked by robots.txt for Googlebot-Image. Google shows one icon per hostname, and doesn't guarantee to show it at all.
- On WordPress, if you added tags by hand and also set a Site Icon, remove the hand-written tags so the two don't compete.
For the sizes and formats behind each file, see favicon specs. For the iPhone icon, see the Apple touch icon guide.
Sources
- <link>: The External Resource Link element (MDN), checked 2026-11
- HTML attribute: rel (MDN), checked 2026-11
- Define a favicon to show in search results (Google Search Central), checked 2026-11
- Create a Favicon (WordPress.org Documentation), checked 2026-11
- Configuring Web Applications (Apple Safari Web Content Guide), checked 2026-11
Questions
How can I put an icon in HTML?
Upload the icon file to your site and add <link rel="icon" href="/favicon.ico"> inside the page's head. For a PNG, add type="image/png" and a sizes value such as 32x32.
What is a site icon?
It's the small square image that stands for your website in browser tabs, bookmarks, search results and phone home screens. Developers call it a favicon; WordPress calls it a Site Icon.
How do I get a site icon?
Make one with the generator on this page from letters, an emoji or your logo, or export a square version of your logo at 512 × 512 px. Then upload the files and add the tags.
Why is my favicon not showing?
Usually the browser is still showing a cached copy, the file path in the tag is wrong, or the tag isn't in the head. Open the icon's address directly to check it loads, then try a private window.