Out of curiosity, does anyone know what's the maximum length (in characters) for a domain name?

Let's exclude the http://www.

I know the maximum length of an url is about 2000 chars. But here I'm more ineterested in just the domain part or the url.

On Wikipedia they say: "The full domain name may not exceed a total length of 253 characters in its external dotted-label specification." But what does that mean?


2 Answers 2

  1. 253 characters is the maximum length of full domain name, including dots: e.g. www.example.com = 15 characters.

  2. 63 characters in the maximum length of a "label" (part of domain name separated by dot). Labels for www.example.com are com, example and www.

This is an example of the domain with longest possible label (it leads to a scammy site): http://www.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com/. The domain name length = 71 characters.

This will be an example of longest domain name: abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com

  • 1
    +1. It is also explained here: en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
    – Ritesh
    Jul 17, 2011 at 13:04
  • If you want an easy way to break many online systems out there, try signing up or using one of these with an email address @ one of the domains above. Jul 18, 2011 at 17:56
  • 5
    Maybe you want to add a normative reference: RFC 1123, chapter 2.1 defines the 63 character limit. But where is the 253 limit defined? Apr 22, 2016 at 6:54
  • 1
    RFC is RFC 1035, section 2.3.4, and it looks like it is 255 characters, not 253. Nov 4, 2021 at 1:25
  • @wp-overwatch.com The 255 limit is in octets for the internal representation. The internal representation includes a byte for the length of each label, and a zero length that terminates the whole domain. So 255 = (1+63)+(1+63)+(1+63)+(1+63)+1. This equates to four 63-char segments plus three dots between them, which totals 253. The "longest domain name" in this answer reduces the first label from 63 to 57 to make room for the com label. Feb 25, 2022 at 17:09

It depends on what you want to do with the domain really.

For a domain just used as a website, the limit is 255 characters. Source: RFC2821 (April 2001) established this and RFC5321 (October 2008) retained this standard. To quote both of them... Domain

The maximum total length of a domain name or number is 255 characters.

For a domain that works with emails, the limit is 253 characters. Source: See the requirements of local-parts (i.e., the user in [email protected]) from RFC821 (August 1982), page 29. This limit is imposed because the to field in e-mails cannot exceed 255 characters, one of those characters must be @, and the local-part must be at least one character long (i.e., a@(253-character-domain), which hits the SMTP 255 to-field limit).

  • Excellent answer. Note that the RFC5321 specifies the SMTP protocol and that it superseeds RFC821. I thus suppose that even with email domain names the maximum size is 255 and not 253.
    – chmike
    May 23 at 12:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.