Skip to main content
HTML Validation

Bad value X for attribute “href” on element “a”: Illegal character in fragment: “{” is not allowed.

About This HTML Issue

Curly braces {} are not allowed in the href attribute value of an <a> element because they are not permitted in valid URLs.

According to the HTML standard and URL specification, certain characters—including { and }—must be percent-encoded in URLs to avoid validation errors and ensure proper browser handling. If you need to include a curly brace in a URL, use percent-encoding: { is %7B and } is %7D.

Incorrect HTML:

<a href="http://example.com/?i=470722{0}">Link</a>

Correct HTML with percent-encoding:

<a href="http://example.com/?i=470722%7B0%7D">Link</a>

Resulting link:

http://example.com/?i=470722%7B0%7D

Only use plain { or } if you are generating URLs client-side (for example, as template placeholders in JavaScript). To validate properly, always encode or remove illegal characters in attribute values.

Learn more:

Last reviewed: July 23, 2025

Was this guide helpful?

Find issues like this automatically

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

Ready to validate your sites?
Start your free trial today.