11. Name syntax
This section deals with the syntax of DNS names. A DNS name is a sequence of labels, separated by dots. Each label is a sequence of characters, with a maximum length of 63 characters. The total length of a domain name (including the dots) is limited to 255 characters. This is a change from RFC1034, which limited the length of a domain name to 255 octets (bytes), not characters.
The characters that are allowed in a label are: letters (A-Z and a-z), digits (0-9), and the hyphen (-). The first and last character of a label must not be a hyphen. Labels are case-insensitive. That is, "example.COM" and "example.com" are the same name.
The underscore (_) is not allowed in a label, except in the special case of service location (SRV) records [RFC2052], where the underscore is used to prefix the service and protocol names.
Any binary string can be represented as a DNS label, using the "xn--" prefix (for the Punycode encoding [RFC3492]), or using the "[" notation (for an escaped sequence of octets). This allows DNS names to contain characters that are not in the standard character set.
A DNS name must not contain any characters that are not allowed in a label. That is, characters such as "/" and ":" are not allowed in a DNS name.
The root label ("") is a special case. It is the only label that is not a sequence of characters. It is represented by a dot at the end of the name.