A single part of a domain — a label between dots — can be at most 63 octets. A complete domain can use at most 255 octets in DNS wire format, including one length byte for each label and the terminating root. That becomes a commonly cited maximum of 253 visible ASCII characters when the final root dot is omitted. A registry may set a shorter limit for the name you can actually register.
Those three numbers answer different questions. The name you buy is usually one label plus a TLD, such as example plus com. A fully qualified host can add subdomains, such as api.eu.example.com. DNS must fit every label and the complete chain within its protocol limits, while a registrar only needs to decide whether the registrable label follows that TLD’s policy.
Labels: the 63-octet rule
Dots divide a domain name into labels. In shop.eu.example.com, the labels are shop, eu, example and com. RFC 1035 encodes each label with a length field whose six available bits limit the following label data to 63 octets.
One component between dots in a domain name. Every label is limited to 63 octets, whether it is a hostname, registered second-level name, subdomain or TLD.
For ordinary ASCII letters and digits, one character occupies one octet, so “63 characters” is usually a workable shorthand. For an internationalized domain name, the Unicode label is encoded as an ASCII-compatible Punycode A-label. The encoded xn--... form — not simply the number of visible Unicode characters — must fit.
Why the full-domain answer is usually 253
RFC 1035 limits the complete domain name to 255 octets in DNS wire format. The wire format does not store visible dots. Instead, it places a length byte before each label and a zero-length byte at the end to represent the root. Once those required bytes are accounted for, the largest printable ASCII form without a trailing root dot is commonly 253 characters.
| Thing measured | Limit | What is included |
|---|---|---|
| One DNS label | 63 octets | Label data only |
| Complete DNS wire name | 255 octets | Labels, their length bytes and terminating root byte |
| Common visible form | Up to 253 ASCII characters | Labels and separating dots, without a final root dot |
| Registrable label | Registry-specific, never above 63 octets | The part selected beneath a TLD |
The exact printable maximum depends on how the characters are split among labels. You cannot place 200 characters into one label merely because the total remains below 253. Every component must pass the 63-octet test independently.
Which characters are allowed?
For an ordinary ASCII hostname, the safe rule is letters A–Z, digits 0–9 and the hyphen. DNS comparisons are case-insensitive, so Example.com and example.com identify the same name. A label can begin with a digit, but it cannot begin or end with a hyphen.
| Example label | Ordinary hostname? | Reason |
|---|---|---|
north-star | Yes | Letters and an internal hyphen |
365tools | Yes | A digit may appear first |
-north | No | Leading hyphen |
north- | No | Trailing hyphen |
north_star | No | Underscore is not hostname syntax |
café | IDN processing required | Unicode must be converted to a valid A-label |
Underscores do appear in DNS at labels such as _acme-challenge.example.com and _sip._tcp.example.com. Those names identify a protocol or service; they are not ordinary website hostnames. This distinction explains why a DNS control panel may accept an underscore even though a registrar will reject it in the name you are buying.
Hyphens and the IDN exception
A hyphen in the middle is technically valid, and sometimes it makes two words readable. The prohibition is on the first and last position. Registries also reserve the xn-- prefix for Punycode A-labels, which is why rules commonly restrict hyphens in the third and fourth positions unless the label is a valid IDN encoding.
Technical validity is not the same as brand quality. green-market.example may be clear in print but harder to dictate because the speaker must say “hyphen.” Multiple hyphens amplify mistyping and can resemble disposable spam domains. Use one only when it materially improves the name.
A long URL is not a long domain
In https://support.example.com/guides/domain-names?lang=en, only support.example.com is the domain name. The scheme, path and query string follow different syntax and software limits. A browser may accept a very long URL while every domain label remains short. See domain name vs URL for a complete breakdown.
Subdomains do count toward the full DNS-name limit. A platform that creates several nested labels from customer input should validate each label at 63 octets and the assembled fully qualified name at the complete-name limit. Leaving headroom is wise because certificates, dashboards and third-party APIs may impose their own shorter constraints.
Practical registration rules
- Check the registry’s policy. A TLD may allow fewer characters, reserve certain labels or reject a pattern that DNS itself could carry.
- Validate the encoded IDN. Count the Punycode A-label rather than the visible Unicode string.
- Keep it well below the maximum. A 63-character brand is difficult to recall, fit into designs, dictate and type.
- Check reserved and protected names. Technical syntax does not make a label available; see reserved domain names explained.
- Test the entire address. Include the extension, possible subdomain and email form when judging usability.
The maximum is a protocol ceiling, not a naming target
Shorter is usually easier to say, recognize and type. Use the limits to prevent invalid input; use audience testing and the framework in how to choose a domain name to choose the actual brand.
★ Key takeaways
- Every label between dots is limited to 63 octets.
- The full wire-format name is limited to 255 octets, commonly 253 visible ASCII characters without a trailing dot.
- Letters, digits and internal hyphens form ordinary ASCII hostnames; underscores serve special DNS labels.
- IDNs must fit after conversion to their
xn--A-label. - A registry can impose tighter naming and reservation rules.
Frequently asked questions
What is the maximum length of a domain name?
Each DNS label can contain at most 63 octets. A complete DNS name can occupy at most 255 octets in wire format, including length fields and the terminating root label. This is commonly expressed as up to 253 visible ASCII characters without a final dot, although valid practical limits depend on label placement and encoding.
Can a domain name contain a hyphen?
Yes. A hostname label may contain letters, digits and hyphens, but a hyphen cannot be the first or last character. IDN A-labels use the reserved xn-- prefix, so registries also apply rules around hyphens in the third and fourth positions.
Can a domain name contain an underscore?
An underscore is not valid in an ordinary hostname label used for a website. DNS itself can carry underscores in special owner names such as _acme-challenge or _sip._tcp because those labels identify services rather than hostnames.
Do dots count in the 63-character limit?
No. The 63-octet limit applies separately to each label between dots. Dots separate labels and contribute to the displayed full name, while DNS wire format uses length fields instead of storing those dots.
Can an internationalized domain use 63 Unicode characters?
Not necessarily. An internationalized label is converted to an ASCII-compatible Punycode A-label beginning xn--, and that encoded form must fit within 63 octets. A visually short Unicode name can therefore reach the limit after conversion.