Course contentsShow
← Web Development
Lesson 87 of 2,9822. HTML FundamentalsFree lesson

Favicon and Icon Links

Adding favicons and touch icons for browsers, bookmarks, and mobile home screens.

Favicon and Icon Links

You'll learn how to add those tiny icons that appear in browser tabs, bookmarks, and on mobile home screens.

What Is a Favicon?

A favicon is a small icon that represents your website. Think of it like a logo for your browser tab—it's that little picture you see next to the page title. The name comes from "favorite icon" because these icons originally appeared in the browser's favorites/bookmarks list.

These icons help users quickly identify your site when they have multiple tabs open or when they've saved your page to their bookmarks or mobile home screen.

How to Add a Favicon

You link to favicon and icon files in the <head> element using the <link> tag, just like you learned with external stylesheets:

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Website</title>
  
  <!-- Standard favicon -->
  <link rel="icon" type="image/png" href="favicon.png">
  
  <!-- Apple touch icon for iOS home screens -->
  <link rel="apple-touch-icon" href="apple-touch-icon.png">
</head>

The rel="icon" attribute tells the browser this is a favicon. The type attribute specifies the image format (usually PNG or ICO), and href points to your icon file.

For mobile devices, especially Apple products, rel="apple-touch-icon" provides a high-quality icon when users save your site to their home screen.

Common Sizes

Modern favicons are typically 32×32 or 64×64 pixels for browsers, while touch icons are often 180×180 pixels for clarity on high-resolution mobile screens.

Key Takeaway: Favicons and touch icons improve user experience by making your site visually recognizable in tabs, bookmarks, and on mobile home screens—add them using <link rel="icon"> in the <head>.