Use a simple, square image, at least 32×32 pixels.
PNG, SVG and ICO formats are widely supported.
Many sites keep the file in the root folder as favicon.ico.
💡 Key Takeaways: HTML Favicon
Mastering HTML Favicon helps you write clean and reliable HTML code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
HTML Favicon Code Example
HTML
<!DOCTYPE html>
<html>
<head>
<title>Page with a favicon</title>
<link rel="icon" type="image/png" href="https://www.google.com/favicon.ico">
</head>
<body>
<h1>Look at the favicon link in the head.</h1>
<p>Open this file in a real tab to see the icon.</p>
</body>
</html>
Free sign-in required · Google login available
HTML Favicon Practice Exercises
Check what you learned in “HTML Favicon”.
/ 3 solved
Fill in the blank
Add a favicon to the page.
<link rel="" type="image/png" href="favicon.png">
✓ Correct!Not quite. Try again.
Multiple choice
Where is the favicon <link> placed?
✓ Correct!Not quite. Try again.
Code challenge
Add a <link rel="icon"> to the head that points to "favicon.ico".
Write the code in the live editor. Your answer is checked automatically.