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

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

The `href` value on the `<a>` element contains a literal `"` character, which is not allowed in a URL path.

The quotes around an attribute value are HTML syntax, not part of the URL. A `"` inside the value is different: written as `&quot;`, or typed inside a single-quoted attribute such as `href='"/brochure.pdf"'`, it becomes a character of the URL itself. The URL standard does not allow a raw `"` in a path, so the validator rejects the whole value. Browsers still follow the link, but they send the quote as `%22` and request a path that usually does not exist.

The stray quote rarely comes from someone typing it. More often the code that writes the link adds it. A template that JSON-encodes the URL before printing it, for example with `JSON.stringify(url)`, wraps the address in an extra pair of quotes. A CMS that stores link settings as JSON, like `{"url":"/brochure.pdf","target":"_blank"}`, can print the wrong piece of that string, so `href` ends up holding a fragment such as `"url":"/brochure.pdf"` or the tail of the object instead of the address. Fix the template so it outputs the plain URL. If a file name really contains a double quote, write it as `%22` in the path.

## Invalid example

```html
<a href="&quot;/brochure.pdf&quot;">Download the brochure</a>
```

## Valid example

```html
<a href="/brochure.pdf">Download the brochure</a>
```
