Skip to main content
HTML Validation

Bad value X for attribute “href” on element “a”: Illegal character in port: “ ” is not allowed.

About This HTML Issue

The URL in this link has a space in its port number, and a port can only contain digits.

In a URL such as https://example.com:8080/, the part after the colon that follows the host is the port. The URL Standard allows only digits there, up to the next /, ? or #. When the parser meets a space before that point, it gives up on the whole URL. A browser can't follow a link it can't parse, so clicking it does nothing.

The usual cause is a phone link written as http://tel: followed by a number with spaces between the digit groups, like http://tel:555 123 4567. The parser reads tel as a host name and the phone number as its port, then fails at the first space. Removing the spaces doesn't help. The link would point at a web server called tel, and most phone numbers are larger than 65535, the highest port allowed.

Phone links use the tel: scheme on its own, with no http:// in front, as defined in RFC 3966. A tel: URL can't contain spaces either, so write the digits together, starting with + and the country code. To keep the number easy to read, put the spaced version in the link text.

When the URL really has a port, the space is usually a typo or whitespace left by a template, as in https://example.com:8080 /reports. Delete it.

Invalid example

<p>Call us at <a href="http://tel:555 123 4567">555 123 4567</a>.</p>

<a href="https://example.com:8080 /reports">Open the reports</a>

Valid example

<p>Call us at <a href="tel:+15551234567">+1 555 123 4567</a>.</p>

<a href="https://example.com:8080/reports">Open the reports</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