Skip to main content
HTML Validation

Bad value X for attribute “href” on element “link”: Illegal character in path segment. Space is not allowed.

About This HTML Issue

Spaces in the href attribute of a <link> element are not valid URL characters and must be encoded as %20.

URLs follow the syntax defined in RFC 3986, which does not allow literal space characters in any component of a URI. The <link> element points to external resources such as stylesheets, icons, and preloaded files, and its href must be a valid URL. A browser often corrects the space on its own, but the markup is still invalid, so the validator flags it.

To fix the issue, replace each space in the URL with %20, the percent-encoded form of the space character. If the resource genuinely lives at a path that contains spaces, the encoding is still required for the reference to be valid.

This often appears with files whose names contain spaces, like an icon exported as Capture 2026-06-23.webp, or with folder names that include spaces.

HTML examples

Invalid: space in href

<link rel="icon" href="https://example.com/files/Capture 2026-06-23.webp">

Valid: spaces encoded as %20

<link rel="icon" href="https://example.com/files/Capture%202026-06-23.webp">

If you control the file or directory names, renaming them to avoid spaces is a simpler long term fix. Use hyphens or underscores instead:

<link rel="icon" href="https://example.com/files/capture-2026-06-23.webp">

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