Favicon in HTML
A favicon is a small icon associated with a website, displayed in the browser tab, bookmarks, and other places. It helps improve branding and user recognition.
How to Add a Favicon
Favicons are typically 16×16 or 32×32 pixel `.ico` or `.png` files. You can include them in your HTML using the <link>
tag inside the <head>
section.
<head>
<link rel="icon" type="image/png" href="favicon.png">
</head>
For better browser compatibility, you can include multiple formats or sizes:
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
Tips
- Place the favicon file in the root or
/images/
directory. - Clear your browser cache if changes are not visible.
- Use online favicon generators to create `.ico` files from images.