Skip to main content
HTML Validation

The “icon” element is a completely-unknown element that is not allowed anywhere in any HTML content.

About This HTML Issue

The <icon> element does not exist in HTML. No version of the HTML specification defines it, and browsers do not recognize it.

This error appears when markup includes <icon> as if it were a standard HTML element. It is not. Browsers will treat it as an unknown inline element with no default behavior or semantics. To display icons, use an <img> element, an <svg> element, or a <span> with CSS-applied background images or icon fonts.

If the intent is to define a favicon (the small icon shown in browser tabs), the correct approach is a <link> element inside <head> with rel="icon".

HTML examples

Invalid: using the <icon> element

<head>
  <title>My page</title>
  <icon src="favicon.png"></icon>
</head>

Valid: using a <link> element for a favicon

<head>
  <title>My page</title>
  <link rel="icon" href="favicon.png" type="image/png">
</head>

Valid: displaying an icon inline with <img>

<p>
  <img src="star.svg" alt="Star" width="16" height="16"> Favorite
</p>

Valid: displaying an icon inline with <span> and CSS

<p>
  <span class="icon icon-star" aria-hidden="true"></span> Favorite
</p>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries