How to handle favicons properly
- User
How to handle favicons properly
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
How to handle favicons properly
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Handling favicons properly is important for branding, user experience, and SEO. A favicon is a small icon associated with a website, displayed in browser tabs, bookmarks, and history. Here's a comprehensive guide to handling them properly:
.ico format, but now includes .png, .gif, and even .svg.Modern browsers support multiple sizes. At a minimum, include:
| Size | Use Case |
|---|---|
| 16x16 | Legacy browser tabs |
| 32x32 | High-DPI browser tabs |
| 48x48 | Some desktop environments |
| 64x64 | High-resolution displays |
| 128x128 | Some apps and tools |
| 180x180 | Apple Touch Icons (iOS) |
| 192x192 | Android Chrome (PWA) |
| 512x512 | Android Chrome (PWA) |
/favicon/.<head>Include the following in the <head> of your HTML document:
<!-- Standard Favicon -->
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<!-- Recommended Sizes -->
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="48x48" href="/favicon-48x48.png">
<link rel="icon" type="image/png" sizes="64x64" href="/favicon-64x64.png">
<link rel="icon" type="image/png" sizes="128x128" href="/favicon-128x128.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png">
<link rel="icon" type="image/png" sizes="512x512" href="/android-chrome-512x512.png">
<!-- Apple Touch Icon -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
<!-- Web App Manifest -->
<link rel="manifest" href="/site.webmanifest">
site.webmanifest (for PWAs)This file defines icons and metadata for Progressive Web Apps.
Example site.webmanifest:
{
"name": "My Website",
"short_name": "MySite",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Some modern browsers support SVG for favicons:
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
Note: Not all browsers support SVG favicons yet, so still provide PNGs as fallback.
Browsers aggressively cache favicons. To see changes:
Use tools like:
You can optionally reference your favicon in robots.txt:
Host: https://example.com
Sitemap: https://example.com/sitemap.xml
You can provide a different icon for dark mode using the media attribute:
<link rel="icon" href="/favicon-light.png">
<link rel="icon" media="(prefers-color-scheme: dark)" href="/favicon-dark.png">
| Task | Done |
|---|---|
| ✅ Create icons in multiple sizes | |
✅ Add correct <link> tags in <head> | |
✅ Include apple-touch-icon for iOS | |
✅ Add site.webmanifest for PWA | |
| ✅ Place files in the correct location | |
| ✅ Test in multiple browsers | |
| ✅ Clear cache after updates | |
| ✅ Consider SVG and dark mode |
Let me know if you'd like a sample favicon package or code snippet generator!