KoderSolution Logo
HomeArticlesTutorialsForumAI LabRun Code
KoderSolution Logo

The world’s most advanced technical ecosystem for modern software engineers. Learn, build, and grow with next-generation developer tools and resources.

Engineering Newsletter

Join 100,000+ engineers receiving curated high-signal content weekly.

Platforms

  • Technical Articles
  • Interactive Tutorials
  • AI Coding Lab
  • Developer Forum
  • Developer Tools

Pages

  • About Us
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Disclaimer
  • Advertisement

Popular Topics

  • PHP
  • Laravel
  • Python
  • React.Js
  • MySQL
© 2026 KoderSolutionAll Rights Reserved
Developed Bymaksudur.dev
🌐

HTML

Topic Hub & Articles

HTML HOME

3 min

HTML Introduction

5 min

HTML Editors

10 min

Recap Quiz

5 Questions

HTML Basic

10 min

HTML Elements

10 min

HTML Attributes

10 min

Recap Quiz

5 Questions

HTML Headings

10 min

HTML Styles

10 min

Recap Quiz

5 Questions

HTML Paragraphs

10 min

HTML Formatting

10 min

HTML Quotations

10 min

HTML Comments

10 min

Recap Quiz

5 Questions

HTML Colors

7 min

HTML CSS

10 min

HTML Links

10 min

Recap Quiz

5 Questions

HTML Images

10 min

HTML Favicon

10 min

HTML Page Title

10 min

Recap Quiz

5 Questions

HTML Tables

10 min

HTML Lists

10 min

HTML Block and Inline

10 min

Recap Quiz

5 Questions

HTML Classes

10 min

HTML Id

10 min

HTML Iframes

10 min

Recap Quiz

5 Questions

HTML JavaScript

10 min

HTML File Paths

10 min

HTML Head

10 min

Recap Quiz

5 Questions

HTML Layout

10 min

HTML Responsive

10 min

HTML Computercode

10 min

Recap Quiz

5 Questions

HTML Forms

10 min

HTML Form Attributes

10 min

HTML Form Elements

10 min

Recap Quiz

5 Questions

HTML Input Types

10 min

HTML Input Attributes

10 min

HTML Input Form Attributes

10 min

Recap Quiz

5 Questions

HTML Canvas

10 min

HTML SVG

10 min

HTML Media Intro

10 min

HTML Video

10 min

HTML Audio

10 min

Recap Quiz

5 Questions

HTML YouTube

10 min

HTML Geolocation

10 min

HTML Drag/Drop

10 min

HTML Local Storage

10 min

Recap Quiz

5 Questions

HTML Session Storage

10 min

HTML Web Workers

10 min

HTML SSE

10 min

Recap Quiz

5 Questions

HTML Semantics

10 min

HTML Accessibility

10 min

HTML Entities

10 min

Recap Quiz

5 Questions

HTML Symbols

10 min

HTML Emojis

10 min

HTML Charset

10 min

Recap Quiz

5 Questions

HTML URL Encode

10 min

HTML XHTML

10 min

HTML Global Attributes

10 min

Recap Quiz

5 Questions

HTML Event Attributes

10 min

HTML Color Groups

10 min

HTML URL Paths

10 min

Recap Quiz

5 Questions

HTML Summary

10 min

Progress
0%

0 / 61 Lessons

HTMLHTML Tutorial
Lesson

HTML Favicon

10 min reading
Free Course

HTML Favicon: Adding Icons to Browser Tabs and Bookmarks

An HTML favicon is a small visual icon displayed next to your website title in browser tabs, bookmark bars, and mobile shortcut screens. It helps users recognize your brand when managing multiple browser tabs.

Favicon Link Tag Syntax and Image Formats

You attach a favicon to an HTML page using the <link> tag inside the <head> section. Modern browsers support PNG, SVG, ICO, and WebP image formats for site icons.

<!-- Standard ICO favicon fallback -->
<link rel="icon" type="image/x-icon" href="/favicon.ico">

<!-- Modern PNG favicon -->
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">

<!-- Scalable SVG favicon for crisp rendering -->
<link rel="icon" type="image/svg+xml" href="/icon.svg">

<!-- Apple Touch Icon for iOS home screens -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png">

Key attributes for favicon declaration:

  1. rel="icon": Specifies that the linked asset is a shortcut icon for the current web document.
  2. type: Defines the MIME media type of the image (e.g. image/svg+xml, image/png, image/x-icon).
  3. href: Specifies the relative or absolute file path to your favicon asset.
  4. sizes: Indicates target icon dimensions (e.g. 32x32 or 16x16).

Favicon Loading Flowchart

The browser checks the HTML head for explicit icon declarations before falling back to default root directory locations:

flowchart TD
    A["Browser Loads HTML Page"] --> B{"Has <link rel='icon'> in <head>?"}
    B -- Yes --> C["Load declared icon asset (SVG / PNG / ICO)"]
    B -- No --> D["Request default /favicon.ico from site root"]
    C --> E["Display icon in browser tab & bookmarks"]
    D --> E

Practical Code Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Favicon Practical Demonstration</title>
    
    <!-- SVG Favicon for modern crisp tab rendering -->
    <link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
    <!-- PNG fallback for legacy browsers -->
    <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
    <!-- Apple home screen icon -->
    <link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png">
</head>
<body style="font-family: system-ui, sans-serif; background-color: #0f172a; color: #f8fafc; padding: 2rem;">

    <h1>Website Favicon Setup</h1>
    <p>Look at the browser tab at the top of your window to see the site icon in action!</p>

</body>
</html>

Best Practices

  • Use SVG for resolution independence: SVG favicons scale sharply on high-density Retina displays and support automatic light/dark mode styling via CSS media queries inside the SVG file.
  • Provide a 180x180 Apple Touch Icon: iOS devices look for rel="apple-touch-icon" when users add your web application to their iPhone or iPad home screen.
  • Store favicon.ico in the root folder: Even with explicit link tags, keep a fallback favicon.ico file in your root web server directory to handle legacy browser requests gracefully.

Self-Check Challenge

Create a <head> element containing a primary SVG favicon (rel="icon"), a 32x32 PNG fallback, and an Apple Touch Icon link pointing to /apple-icon.png !

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Recommended Courses & Books

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum