Skip to main content
HTML Validation

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

About This HTML Issue

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: 
 or 
 for a line feed, 	 for a tab.

The validator shows the decoded value, so the message contains a real line break even when the source has 
. 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

<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

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

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
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries