简体   繁体   中英

Maximum length of a domain name without the http://www. & .com parts

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?

每个标签最多可包含 63 个字符。

"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."

http://tools.ietf.org/html/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)."

http://tools.ietf.org/html/rfc2181

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...

作为演示,本网站有一个 63 个字符的域名,最大允许: http : //63-characters-is-the-longest-possible-domain-name-for-a-website.com

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 user@domain.com , 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 of 63 . I recommend sticking with 63 . "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM