# 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-less-than-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 URL standard does not allow a raw `<` anywhere in a URL. Escaping it as `&lt;` does not help, because the HTML parser turns `&lt;` back into `<` before the URL is read. If a path really needs the character, write it as `%3C`.

A value that starts with part of a tag, such as `<div class=`, means a template or content filter wrote HTML where a URL belongs. Lazy-loading and video embed plugins can do this when they swap a video URL for placeholder markup without checking whether the URL sits inside an attribute. The first `"` in that markup closes the `href`, so the value stops at `class=` and the browser treats it as a relative path to a page that doesn't exist.

The rest of the injected tag spills into the `<a>` start tag as broken attributes. That's why the validator usually also reports a stray end tag and a quote in an attribute name for the same link. Those errors go away once the `href` holds a plain URL.

Other values with a `<` come from angle brackets copied along with an address, as in `<https://www.example.com/>` from a plain-text email, or from placeholders like `/files/<name>.pdf` left in a template. Remove the brackets or fill in the real value.

## Invalid example

```html
<a href="<div class="video-embed" data-src="https://www.example.com/embed/abc123"></div>">Watch the video</a>
```

## Valid example

```html
<a href="https://www.example.com/embed/abc123">Watch the video</a>
```
