Length of a domain name

If you Google for "longest domain name" you'll find a lot of conflicting information. For example, you'll probably find more than a few sites that say that a domain name cannot be more than 63 characters. That's sort of true and sort of untrue, but to understand why takes some digging (figuratively and literally, as you'll see).

It gets pretty ridiculous. For example, at one time someone registered this silliness:


http://www.thelongestdomainnameintheworldandthenso
meandthensomemoreandmore.andyoucanaddsomemoretotha
taswell.andabitmore.andwhynotgoonabit.aboutwatneys
redbarrel.andalizardinthebleedingbidet.andnothingt
oeatexcept.britishairwayssandwiches.etcetcetcand.theinfo.net/
 

All of that except "www" is a domain name - subdomains of subdomains, all under "theinfo.net". To make things even more confusing, the person could have added another host called "peanuts" (or wahatever) and could have had "www" and "peanuts" served by different websites and most of us would think of www.all the rest and peanuts.all the rest as separate website domains!

Let's just ignore the confusion of website domains, shall we? Trust me, it's bad enough without that. For the moment, let's look at the definition of "domain name".


A domain is identified by a domain name, and consists of that part of the domain name space that is at or below the domain name which specifies the domain. A domain is a subdomain of another domain if it is contained within that domain. This relationship can be tested by seeing if the subdomain's name ends with the containing domain's name. For example, A.B.C.D is a subdomain of B.C.D, C.D, D, and " ".

That's from RFC1034. So, if we want to get pedantic, that "theinfo.net" mess was a subdomain, not a domain. According to the same RFC, each component of a subdomain is limited to 63 characters, so THAT would be the actual limit of a domain name.

Assuming we're just counting characters, of course. What if we get into typography? An "m" is wider than an "i", so a 63 character domain name with a lot of "m"'s in it would be "longer" (wider) than one without.. silly? Sure, but the whole thing is silly, isn't it?

Whoever owns

thelongestdomainnameintheworld
andthensomeandthensomemoreandmore.com
 

(63 characters when you take away ".com") tried to get recognition from Guinness World Records. Guinness responded:


This record is currently rested, which means that no one can attempt this record and become a new record holder. It has been rested because there is no merit whatsoever in this. It takes little to no effort and is similar to taking the largest number in the world and then adding 1 to it.

That's not accurate. You can't just go on adding letters to a domain name and you can't have an infinitely long subdomain. The same RFC plainly says:


To simplify implementations, the total number of octets that represent a domain name (i.e., the sum of all label octets and label lengths) is limited to 255.

I didn't explain "label lengths" before. Again, we turn to the RFC:


Internally, programs that manipulate domain names should represent them as sequences of labels, where each label is a length octet followed by an octet string. Because all domain names end at the root, which has a null string for a label, these internal representations can use a length byte of zero to terminate a domain name.

Given that the "theinfo.net" silliness adds up to 242 characters (subtract the "."'s) and has 11 components, that comes to only 253, so there are 2 characters missing somewhere!

Note: the original RFC for hostnames is RFC-952, which says (in part):


A "name" (Net, Host, Gateway, or Domain name) is a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-), and period (.). Note that periods are only allowed when they serve to delimit components of "domain style names". (See RFC-921, "Domain Name System Implementation Schedule", for background). No blank or space characters are permitted as part of a name. No distinction is made between upper and lower case. The first character must be an alpha character. The last character must not be a minus sign or period.

That was modified by RFC-1123 to allow either a letter or a digit as the first character, but underscores are not allowed anywhere in names.

However (there's always a gotcha), that 253 character name might not work everywhere. RFC1123 says that


Host software MUST handle host names of up to 63 characters and SHOULD handle host names of up to 255 characters.

Notice that they are blurring host names and DNS components. That's OK; it's pretty blurry anyway. For example, is "scofaq.aplawrence.com" the host "scofaq" at "aplawrence.com" or might there be a "peanuts.scofaq.aplawrence.com"?

Hard to say, isn't it? One quick check is to ask for an "mx" record. A subdomain doesn't HAVE to have an "mx", but if it does, we know it is a subdomain and not a host.

# dig +short  scofaq.aplawrence.com mx  <- probably host (no answer)
# dig +short google.com  mx  <- domain (returns hosts)
20 alt1.aspmx.l.google.com.
10 aspmx.l.google.com.
30 alt2.aspmx.l.google.com.
50 alt4.aspmx.l.google.com.
40 alt3.aspmx.l.google.com.
# dig +short gmail.com mx  <- domain (returns hosts)
20 alt2.gmail-smtp-in.l.google.com.
5 gmail-smtp-in.l.google.com.
40 alt4.gmail-smtp-in.l.google.com.
30 alt3.gmail-smtp-in.l.google.com.
10 alt1.gmail-smtp-in.l.google.com.
# dig +short mail.google.com  mx <- domain? (returns host, but note no priority) 
googlemail.l.google.com.
# dig +short googlemail.l.google.com mx  <- probably host (no answer)
# dig +short plus.google.com  mx  <- domain (returns hosts)
40 alt3.aspmx.l.google.com.
30 alt2.aspmx.l.google.com.
20 alt1.aspmx.l.google.com.
10 aspmx.l.google.com.
50 alt4.aspmx.l.google.com.
# dig +short code.google.com  mx
code.l.google.com. <- domain (returns host)
 

Back to the contenders for one last look. We have The World's Longest Single Word Domain Name! which perhaps does deserve Guinness as it is a real place name (created for publicity reasons long before the Internet). Although "llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch" weighs in at only 60 characters, I think it deserves recognition.

Then we have this, which is billed as "The world's longest alphabetical email address":

World's longest alphabetical email address

Remember the "would" and "should" of RFC1123 above? Point taken.



Got something to add? Send me email.





(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Length of a domain name




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Silence is better than unmeaning words. (Pythagoras)

A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year. (Andrew S. Tanenbaum)








This post tagged: