Skip to main content

HTML Guide

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

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:

Related W3C validator issues