Published on

Domain Name Length Limits

Authors
  • avatar
    Name
    hwahyeon
    Twitter

According to the DNS standard, domain names have strict length limits:

PartLimitNotes
Full domain nameUp to 253 octets in ordinary text formThe DNS wire format allows up to 255 octets. A trailing root dot may make the displayed form 254.
Each labelUp to 63 octetsA label is each part separated by dots, such as www, example, and com.

Why 253 and not 255?

RFC 1035 limits the DNS wire-format representation of a full domain name to 255 octets.

In the wire format:

  • Each label is preceded by a one-octet length field.
  • The name ends with a zero-length label representing the DNS root.
  • The dots used in textual notation are not stored as literal dots in the wire format; they correspond to the boundaries between labels.

As a result, the maximum length of the usual textual form without a trailing root dot is 253 octets. If the final root dot is explicitly included, the textual form can be 254 octets long.

Implication

  • DNS does not define a separate fixed limit on the number of labels.
  • However, the total name-length limit restricts how many labels a domain name can contain.
  • No individual label may exceed 63 octets.
  • For example, a.b.c.d.e.f.example.com is valid as long as every label and the full domain name remain within their respective limits.