How to add a browser tab icon (favicon) for a website?
To add a favicon to your website, insert this HTML tag in the <head>
section:
For an even tastier recipe with more compatibility, also have a PNG version:
Make sure you got your icon's URL right. If the icon is stored locally, full domain isn't required. Like the local pizzeria, it's just around the corner!
Comprehensive favicon guide
When it comes to favicons, there's more to the story. Let's dive into the details, ensure compatibility across devices, and master those best practices to turn your website into an eye-candy!
Mastering formats and sizes
Your favicon should be like a chameleon, adapting to different environments. Include multiple sizes like 16x16, 32x32, and 96x96 pixels, to please those picky devices.
Now, ICO is your old faithful - not exciting but works everywhere, especially with those retro browsers. PNG is the new kid on the block, with a knack for transparency, loved by modern browsers.
Use a favicon generator to transform your image into a masterpiece of different sizes and formats - because who doesn't love tools doing the hard work!
Apple and Microsoft customizations
Be the host with the most. Welcome Apple and Microsoft with open arms:
Android and Chrome
Don't forget your friends Android and Chrome M39+. A well-planned manifest.json
will go a long way:
Within manifest.json, define icons and theme colors for a consistent user experience on these platforms.
Advantages of SVG
SVG favicons are like versatile ninjas. They scale excellently and can have CSS-based theming. Why create extra HTTP requests when one SVG can do the job?
Just keep an eye on your SVG's performance and test across different platforms.
Get the most out of your favicons
Go the extra mile with browserconfig.xml
for Windows or a well-configured .htaccess
file. Cache your favicon and enable GZIP compression.
Craft a cross-device favicon strategy
Take your favicon to the next level by catering to the specific requirements of various browsers and devices.
Taming browsers
Different browsers follow different rulebooks. So, it's important to accommodate the individual needs of IE, Edge, iOS devices and others.
Here's how you can customize the Windows Start screen pins with browserconfig.xml:
iOS devices and Android Chrome also have their nuances, which can be captured with certain meta tags:
Consistency & performance
Having a well-performing, visually consistent favicon across platforms is not optional - it's essential. Websites like Can I Use provide current compatibility tables, especially when considering SVGs or newer formats.
Was this article helpful?