Maximum length of a domain name without the http://www. & .com parts
UrlDnsMaxUrl Problem Overview
What is the maximum length of the 'name' part in a domain?
I'm referring to the google
in http://www.google.com
. How long can the google
part be without what's before and after it?
Url Solutions
Solution 1 - Url
Each label may contain up to 63 characters.
Solution 2 - Url
"URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately apparent, and should limit these names to no more than 255 characters in length."
https://www.rfc-editor.org/rfc/rfc3986
"The DNS itself places only one restriction on the particular labels that can be used to identify resource records. That one restriction relates to the length of the label and the full name. The length of any one label is limited to between 1 and 63 octets. A full domain name is limited to 255 octets (including the separators)."
Solution 3 - Url
The full domain name may not exceed a total length of 253 characters in its external dotted-label specification.
http://en.wikipedia.org/wiki/Domain_Name_System
If you are getting anywhere close to 253 characters, I think you should look for a shorter domain name...
Solution 4 - Url
As a demonstration, this website has a 63 characters domain name, the maximum allowed: http://63-characters-is-the-longest-possible-domain-name-for-a-website.com
Solution 5 - Url
TLDR Answer
Use these limits:
>Labels: 61
octets.
>
>Names: 253
octets.
Many applications will work even if you exceed these limits (like Gmail), but there are many older applications that will not.
Source
RFC1035: Domain Names - Implementation And Specification (published November 1987), an accepted Internet Standard, gives the following limits to subdomains and to the entire domain length when viewed in a browser...
>Various objects and parameters in the DNS have size limits. They are
listed below. Some could be easily changed, others are more
fundamental.
>
>labels 63
octets [bytes/characters] or less
>
>names 255
octets [bytes/characters] or less
The working level of these are:
- Labels:
61
octets. - Names:
253
octets.
That's because RFC821
(published August 1982) defines emails in the format of [email protected]
, and the smallest value for user
would be one character. That leaves one character for @
, and then you only have 253
characters left for the domain.com
part.
This was reconfirmed numerous times...
-
RFC2181: Clarifications to the DNS Specification (published July 1997) : Only a proposed standard. "A full domain name is limited to 255 octets (including the separators)."
-
RFC3986: Uniform Resource Identifier (URI): Generic Syntax (published January 2005) : Accepted Internet standard. "URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately apparent, and should limit these names to no more than 255 characters in length."
-
RFC5321: Simple Mail Transfer Protocol (published October 2008) : Only a proposed standard. This RFC gives the max length of label or subdomains to be
64
, one more than the others of63
. I recommend sticking with63
. "The maximum total length of a domain name or number is 255 octets."
You may have 63 characters per label (or subdomain) and 255 characters per name (this includes the TLD).
Notice that it gives the definition in octets. That's because it's looking at physical bytes, not literal bytes. For instance, \.
is interpreted as .
(one literal byte), because the \
escapes it, but it is encoded as \.
(two physical bytes). These octet limits are physical byte limits.