# Bad value X for attribute “href” on element “a”: Invalid host: A domain name label is longer than 63 bytes.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-href-on-element-a-invalid-host-a-domain-name-label-is-longer-than-63-bytes
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The host in this link's URL has a label longer than 63 bytes, which is more than DNS allows for a single label.

A domain name such as `docs.example.com` is made of labels separated by dots: `docs`, `example` and `com`. RFC 1035 limits each label to 63 bytes, and the validator checks this limit when it parses the host of the URL. DNS can't resolve a host with a longer label, so the link leads nowhere.

The limit applies to the ASCII form of the label. Internationalized domain names are converted to Punycode (`xn--...`) before the check, and that encoding takes more bytes than the original characters, so a label with non-ASCII letters can go over the limit even when it looks shorter.

Real domains almost never have labels this long. The error usually comes from a missing slash between the domain and the path, which glues the path onto the top-level domain, or from a template that puts an ID or token where a subdomain should go. Paths and query strings have no per-segment limit like this, so moving the long part out of the host fixes the URL.

The validator reports a host that is too long as a whole (more than 255 bytes) with a different message.

## Invalid example

The slash after `example.com` is missing, so the whole path becomes part of the last label:

```html
<a href="https://example.comguides-to-writing-valid-html-for-accessible-websites-and-apps">Read the guide</a>
```

A long token used as a subdomain has the same problem:

```html
<a href="https://5f2b8c1e9a7d4e6b8c3f1a2d9e7b5c4a6e8f1b3d5a7c9e2f4b6d8a1c3e5f7b9d.cdn.example.com/logo.png">Logo</a>
```

## Valid example

Put the slash back, or move the token into the path:

```html
<a href="https://example.com/guides-to-writing-valid-html-for-accessible-websites-and-apps">Read the guide</a>

<a href="https://cdn.example.com/5f2b8c1e9a7d4e6b8c3f1a2d9e7b5c4a6e8f1b3d5a7c9e2f4b6d8a1c3e5f7b9d/logo.png">Logo</a>
```
