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

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-href-on-element-a-illegal-character-after-ilto-square-bracket-is-not-allowed
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

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

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

## Valid example

Percent-encode the square brackets in the query string:

```html
<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.
