# Bad value X for attribute “href” on element “a”: Tab, new line or carriage return found.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-href-on-element-a-tab-new-line-or-carriage-return-found
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The URL in the `href` attribute has a tab or a line break inside it, and a valid URL can't contain either.

HTML lets the `href` value start or end with whitespace, so line breaks before or after the URL are allowed. Inside the URL they are not: the URL Standard counts every tab, line feed and carriage return as a validation error. Browsers remove these characters before they follow the link, so the first link in the invalid example below still opens `https://example.com/courses/web-design/`. Scripts that read the value with `getAttribute("href")` get the raw string with the line break in it, and a tool that doesn't strip the break the way browsers do may request the wrong address.

The line break often arrives with the content. A URL pasted into a CMS link field can carry one, and a template that splits a long URL across lines writes the break into the attribute. Some systems output it as a character reference: `&#xA;` or `&#10;` for a line feed, `&#9;` for a tab.

The validator shows the decoded value, so the message contains a real line break even when the source has `&#xA;`. Search the source for those references as well as for literal breaks, then fix the stored value or strip tabs and line breaks from the URL before the template writes it.

## Invalid example

```html
<a href="https://example.com/courses/web-design&#xA;/">Web design course</a>
<a href="https://example.com/courses/
web-design/">Web design course</a>
```

## Valid example

```html
<a href="https://example.com/courses/web-design/">Web design course</a>
```
