The small icon displayed in a browser tab, often called a favicon or web icon, is a key part of your site's identity. It helps users find your tab among many, appears in bookmarks and history, and is shown next to your site in mobile search results. Changing it is mostly a matter of HTML, but the details matter. Using the wrong format, missing a size, or forgetting about caching can leave visitors seeing an outdated or blurry icon. This guide explains exactly how to change a web icon with HTML, from basic tags to modern best practices.
Professional Front-End Support from AAMAX.CO
Small details such as icons, metadata, and social preview images shape how professional a brand looks. AAMAX.CO is a full-service digital marketing company offering web development, digital marketing, and SEO services worldwide. Their website design team creates complete icon sets that match your brand and implements them correctly in clean, standards-compliant HTML. They also make sure your metadata supports search visibility, so your icon and listing look sharp everywhere they appear.
The Basic HTML Tag for a Web Icon
The web icon is defined with a <link> element inside the <head> of your HTML document. The simplest version looks like this:
<link rel="icon" href="/favicon.ico">The rel="icon" attribute tells the browser this resource is the page icon, and href points to the file. If no tag is present, many browsers automatically request /favicon.ico from the root of your domain. That is why placing a file with that exact name at the root still works on older sites. However, relying on that fallback is not recommended for modern websites.
Choosing the Right File Format
Several file formats are supported for web icons:
- ICO: The classic format that can contain multiple sizes in one file. It offers the widest compatibility, including older browsers.
- PNG: Widely supported, simple to create, and good for specific sizes such as 32x32 or 180x180.
- SVG: Scalable and lightweight, it looks crisp at any resolution and supports CSS media queries for dark mode.
A modern, robust approach combines an ICO for legacy support with an SVG for modern browsers.
A Complete, Modern Icon Setup
Here is a recommended HTML snippet that covers nearly every browser and device:
<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">The sizes="32x32" attribute on the ICO prevents some browsers from choosing it over the SVG. The Apple touch icon, at 180x180 pixels, is used when iPhone and iPad users add your site to the home screen. The manifest file supplies larger icons for Android and installable web apps.
Step-by-Step: Changing Your Existing Web Icon
1. Create your new icon. Design a square image with simple shapes and strong contrast. Export it as SVG, a 32x32 ICO, and a 180x180 PNG.
2. Upload the files. Place them in your website's root or a dedicated assets folder.
3. Find the existing tags. Search your HTML templates, header include files, or theme files for rel="icon" or rel="shortcut icon". Remove outdated or duplicate tags to avoid conflicts.
4. Add the new tags. Insert the updated link elements in the head of every page, ideally through a shared layout or template.
5. Deploy and test. Open your site in multiple browsers to verify the new icon appears.
Supporting Dark Mode with an SVG Icon
A dark icon on a transparent background can become invisible in dark browser themes. SVG icons solve this because they can include CSS media queries:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<style>
path { fill: #1E0100; }
@media (prefers-color-scheme: dark) { path { fill: #FFF8EE; } }
</style>
<path d="..." />
</svg>With this approach, the icon automatically switches color to match the user's theme, keeping your brand visible in any environment.
Why the New Icon Is Not Showing
Browsers cache favicons aggressively. Even after you change the file, visitors may see the old icon for days. To force an update, change the file name or append a version string:
<link rel="icon" href="/icon.svg?v=3" type="image/svg+xml">You can also clear your browser cache, open the icon URL directly and refresh it, or test in a private window. If your site uses a CDN, purge the cached icon files there as well. Service workers can also serve old assets, so update their cache version if your site uses one.
Changing Icons in Popular Frameworks and CMS Platforms
Many platforms manage icon HTML for you. In WordPress, go to Appearance > Customize > Site Identity and upload a Site Icon; WordPress generates all required tags. In Next.js, placing icon.png, icon.svg, or apple-icon.png in the app directory generates tags automatically. Shopify, Wix, and Squarespace each provide a favicon upload field in their settings. When using these platforms, avoid adding manual tags that might conflict with automatically generated ones.
Best Practices for Web Icons
- Keep designs simple and recognizable at 16 pixels.
- Use your brand mark rather than the full logo with text.
- Optimize file sizes, especially for PNG files.
- Include a single source of truth for icon tags in your layout.
- Test on desktop, mobile, light mode, and dark mode.
Conclusion
Changing a web icon with HTML is straightforward once you understand the link tags, formats, and caching behavior involved. Combine an ICO and SVG for broad compatibility, add an Apple touch icon and manifest for mobile devices, and use versioned file names to ensure visitors see your update. A crisp, consistent icon reinforces your brand every time someone opens a tab, bookmarks a page, or finds you in search results.