A hostname is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication such as the World Wide Web, e-mail or Usenet. Hostnames may be simple names consisting of a single word or phrase, or they may have appended a domain name, which is a name in a Domain Name System (DNS), separated from the host specific label by a period (dot). In the latter form, the hostname is also called a domain name. If the domain name is completely specified including a top-level domain of the Internet, then the hostname is said to be a fully qualified domain name (FQDN).
Example: 'saturn' and 'jupiter' could be the hostnames of a couple of devices connected to a network called Alpha. Within Alpha the devices are reached by their hostname. Alpha could be configured so that its domain name is 'alpha' (in lower case letters). In that case, the mentioned devices' hostnames, including the domain-name, would be 'saturn.alpha' and 'jupiter.alpha', respectively. With these names they could be reached in a private network of networks, each with its own domain name. If alpha is registered and can be reached as alpha.net on the Internet, then the fully qualified domain names for the devices would be 'saturn.alpha.net' and 'jupiter.alpha.net'.
Hostnames that include DNS domains are often stored in the Domain Name System together with the IP addresses of the host they represent for the purpose of mapping the hostname to an address, or the reverse process.
Hostnames are human-readable nicknames that correspond to the address of a device connected to a network. They are used by various naming systems, e.g., Network Information Service (NIS), Domain Name System (DNS), Server Message Block (SMB), and the meaning of hostname will vary according to the naming system used. A hostname meaningful to a Microsoft NetBIOS workgroup may be an invalid Internet hostname. When presented with a hostname without any context, it is usually safe to assume that the network is the Internet and the hostname's naming system is the DNS.
Host names are typically used in an administrative capacity and may appear in computer browser lists, active directory lists, IP address to hostname resolutions, email headers, etc.
On the Internet, a hostname is a domain name assigned to a host computer. This is usually a combination of the host's local name with its parent domain's name. For example, en.wikipedia.org consists of a local hostname (en) and the domain name wikipedia.org. This kind of hostname is translated into an IP address via the local hosts file, or the Domain Name System (DNS) resolver. It is possible for a single host computer to have several hostnames; but generally the operating system of the host prefers to have one hostname that the host uses for itself.
Any domain name can also be a hostname, as long as the restrictions mentioned below are followed. So, for example, both en.wikipedia.org and wikipedia.org are hostnames because they both have IP addresses assigned to them. The domain name pmtpa.wikimedia.org is not a hostname since it does not have an IP address (as of now), but rr.pmtpa.wikimedia.org is a hostname. A hostname may be a domain name, if it is properly organized into the domain name system. A domain name may be a hostname if it has been assigned to an Internet host and associated with the host's IP address.
Restrictions on valid host names
Hostnames are composed of series of labels concatenated with dots, as are all domain names. For example, "en.wikipedia.org" is a hostname. Each label must be between 1 and 63 characters long, and the entire hostname (including the delimiting dots) has a maximum of 255 characters.
The Internet standards (Request for Comments) for protocols mandate that component hostname labels may contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-'). The original specification of hostnames in RFC 952, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. No other symbols, punctuation characters, or white space are permitted.
While a hostname may not contain other characters, such as the underscore character (_), other DNS names may contain the underscore. Systems such as DomainKeys and service records use the underscore as a means to assure that their special character is not confused with hostnames. For example,
_http._sctp.www.example.com specifies a service pointer for an SCTP capable webserver host (www) in the domain example.com. Note that some applications (e.g. IE) won't work correctly if any part of the hostname will contain an underscore character.
One common cause of non-compliance with this specification is that the rules are not applied consistently across the board when domain names are chosen and registered.
The hostname en.wikipedia.org is composed of the DNS labels en (hostname or leaf domain), wikipedia (second-level domain) and org (top-level domain). Labels such as 2600 and 3abc may be used in hostnames, but -hi- and *hi* are invalid.
A hostname is considered to be a fully qualified domain name (FQDN) if all the labels up to and including the top-level domain name (TLD) are specified. The hostname en.wikipedia.org terminates with the top-level domain org and is thus fully qualified. Depending on the operating system DNS software implementation, an unqualified hostname such as csail or wikipedia may be automatically combined with default domain names configured into the system, in order to determine the fully qualified domain name. As an example, a student at MIT may be able to send mail to "joe@csail" and have it automatically qualified by the mail system to be sent to email@example.com.
General guidelines on choosing good hostnames are outlined in RFC 1178.