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

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

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

```html
<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

```html
<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>
```
