User Agents

Web browsers and everyday web tech, explained

How to Add a Favicon to Your Website Browser Tab

· 5 min read · How the Web Works

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Adding a favicon (the small image next to your page title in the browser tab) makes your site look more professional and helps users identify your page at a glance. It's a tiny but important branding detail. You'll need an image file (preferably in .ico, .png, or .svg format) and access to your website's HTML files or a way to upload files to your server. If you're using a website builder or CMS like WordPress, the steps may differ slightly, but the core concept is the same.

What You'll Need

  • An image file for your favicon (recommended size: 32x32 pixels or 16x16 pixels; .ico is most compatible, but .png works in modern browsers).
  • Access to your website's HTML file (usually index.html or a header template) or a file manager where you can upload files to your web server.
  • A text editor (like Notepad, VS Code, or Sublime Text) if you're editing HTML directly.
  • For CMS users: access to the theme editor or a plugin that allows custom code insertion.

Step-by-Step

  1. Create or choose your favicon image. Use a simple, recognizable icon. If you don't have one, you can create it in any image editor. Resize it to 32x32 pixels (or 16x16). Save it as favicon.ico if possible, or favicon.png for modern browsers. Make sure the file is small (under 100KB) for fast loading.
  2. Upload the favicon file to your website's root directory. This is the main folder where your homepage file (e.g., index.html) is located. Use your hosting file manager or FTP client (like FileZilla) to upload the file. If you're using a CMS, you can upload via the media library and get the URL.
  3. Add the link tag to your HTML head. Open your website's main HTML file (or header template) and locate the <head> section. Add the following line inside it, replacing favicon.ico with your file name if different:
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    For a PNG file, use:
    <link rel="icon" href="favicon.png" type="image/png">
    If your favicon is in a subfolder or on a CDN, use the full URL or relative path (e.g., /images/favicon.png).
  4. Save and upload the modified HTML file. If you edited locally, upload the file to your server, overwriting the old one.
  5. Clear your browser cache and refresh. Browsers often cache favicons aggressively. Hard refresh (Ctrl+F5 on Windows, Cmd+Shift+R on Mac) or clear your cache to see the new favicon.
  6. Test in multiple browsers. Open your site in Chrome, Firefox, Safari, and Edge to ensure the favicon appears. If it doesn't, check the file path and format.

Common Mistakes

  • Using a large image file. A favicon should be tiny (16x16 or 32x32 pixels). Using a full-size logo will slow down your site and may not display correctly.
  • Wrong file format. Some older browsers only support .ico files. If you use .png, test in older browsers or provide both formats.
  • Incorrect file path. If you put the favicon in a subfolder but reference it as if it's in the root, it won't work. Double-check the path.
  • Forgetting the type attribute. While not strictly required for modern browsers, including it helps with compatibility.
  • Not clearing the cache. You might think the favicon is broken when it's just cached. Always hard refresh.

Tips

  • Use a .ico file for maximum compatibility. If you're not sure which format to use, .ico is the safest bet. You can convert PNG to ICO using free online tools.
  • Keep it simple. Favicons are tiny, so complex images become unrecognizable. Use a single letter, a simple symbol, or a small version of your logo.
  • Consider a SVG favicon. Modern browsers support SVG favicons, which scale perfectly and look sharp on high-DPI screens. You can use <link rel="icon" href="favicon.svg" type="image/svg+xml">.
  • Add multiple sizes. For better quality on different devices, you can add multiple link tags for different sizes (e.g., 16x16, 32x32, 48x48).
  • Use a favicon generator. If you're not comfortable creating your own, many free online tools can generate a favicon from an image or text.

Troubleshooting

  • Favicon not showing after adding the link tag? First, hard refresh your browser. If it still doesn't show, check that the file is actually in the correct location on your server. Open the URL directly in your browser (e.g., yoursite.com/favicon.ico) to see if the file is accessible. If you get a 404, the path is wrong.
  • Favicon appears in some browsers but not others? This usually means the format isn't supported. Try converting to .ico or adding both .ico and .png links.
  • Favicon is distorted or blurry? Your source image may be too small or not square. Use a 32x32 or 64x64 pixel image and let the browser scale it down.
  • Favicon works locally but not on the live site? If you're testing from a local file, the browser might use a different caching mechanism. Upload the file and test on the live site.
  • Still not working? Check for typos in the link tag. Ensure it's inside the <head> section, not in the body. Also verify that your server isn't blocking .ico files (rare but possible).

Frequently Asked Questions

Do I need a favicon for my website?

No, it's not required, but it improves user experience and brand recognition. Without one, browsers show a blank or default icon, which looks unprofessional.

Can I use a PNG as a favicon?

Yes, modern browsers support PNG favicons. However, some older browsers (like older Internet Explorer) only support .ico. To be safe, you can use .ico or provide both.

What is the ideal size for a favicon?

The standard sizes are 16x16 and 32x32 pixels. For high-DPI screens, 48x48 or even 64x64 can be used, but the browser will scale it down. Keep the file size small.

How do I create a favicon from my logo?

You can use any image editor to resize your logo to 32x32 pixels and export it as .ico or .png. Or use an online favicon generator that does this automatically.

Will a favicon affect my SEO?

Not directly, but it can improve click-through rate from search results when your site appears with a recognizable icon in the browser tab. Google has been known to display favicons in mobile search results.

Can I have a different favicon for different pages?

Yes, you can add a different <link> tag in the <head> of each page. This is useful for sections of your site that have distinct branding.