Amount of allowed subdomains in domain and email

There are no direct limits on how many levels i.e. dots you can have in a hostname. However, a RFC1034 compliant hostname can only be 255 bytes long, leaving 253 bytes for a fully qualified domain name FQDN in DNS. Some systems and TLS/SSL limits FQDN to 64 bytes and FQDN in emails should not exceed(*) 245 or 221 or 189 bytes depending on the maximum user name length (8, 32 or 64).

As TLD usually takes at least 2 characters and . and every part of the hostname must be at least one character long, the space left for additional dots i.e. theoretically maximal levels would be:

  • (253-3)/2 = 125 levels after TLD for theoretically longest (not so useful) hostname
  • (221-3)/2 = 109 or (189-3)/2 = 93 levels after TLD, if you wish to use it for email
  • (63-3)/2 = 30 levels after TLD, if you wish to use SSL/TLS.

And yes, [email protected] is in a valid email address format.


(*) The special limitation for email address length is a result of RFC 5321 4.5.3.1 and 4.1.2:

4.5.3.1.1.  Local-part

   The maximum total length of a user name or other local-part is 64
   octets.

4.5.3.1.3.  Path

   The maximum total length of a reverse-path or forward-path is 256
   octets (including the punctuation and element separators).

4.1.2 Command Argument Syntax

   Path           = "<" [ A-d-l ":" ] Mailbox ">"

As forward-path must include the angle brackets, only 254 characters are left for the email address. Then, the username@ part of 8(+1), 32(+1) or 64+1 must be excluded to get the maximum FQDN lenght.