Skip to main content
HTML Validation

Bad value X for attribute “href” on element “a”: Illegal character after “ilto:”. “[” is not allowed.

About This HTML Issue

A mailto: link in an href attribute contains a [ character that is not valid in a URI according to RFC 3986.

Square brackets ([ and ]) are reserved characters in URIs and must be percent-encoded when used outside their specific purpose (IPv6 address literals). If the email address or other part of the mailto: URI contains a [, it must be encoded as %5B. Similarly, ] must be encoded as %5D.

This error typically appears when a mailto: link includes square brackets in the subject, body, or display-related parts of the URL. Query parameters in mailto: links — such as ?subject= or ?body= — must have their values properly percent-encoded.

Invalid example

<a href="mailto:info@example.com?subject=[Action Required] Review">
  Email us
</a>

Valid example

Percent-encode the square brackets in the query string:

<a href="mailto:info@example.com?subject=%5BAction%20Required%5D%20Review">
  Email us
</a>

The [ becomes %5B, the ] becomes %5D, and spaces become %20. Most server side languages and JavaScript provide functions to handle this encoding automatically, such as encodeURIComponent() in JavaScript.

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