On the Internet, the terms "hostname" and "domain name" are often used interchangeably, but there are subtle technical differences between them.
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. They are human-readable nicknames, which ultimately correspond to unique network hardware MAC addresses. In some cases the host name may contain embedded domain names and/or locations, non-dotted IP addresses, etc.
On a simple local area network, a hostname is usually a single word: for instance, an organization's CVS server might be named "cvs" or "server-1".
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, 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.
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 has a maximum of 255 characters.
RFCs mandate that a hostname's labels may contain only the ASCII letters 'a' through 'z' (case-insensitive), the digits '0' through '9', and the hyphen. Hostname labels cannot begin or end with a hyphen. No other symbols, punctuation characters, or blank spaces are permitted.
Systems such as DomainKeys and service records use the underscore as a means to assure their special domain names are not confused with hostnames. As a notable example of non-compliance, Windows systems often use underscores in hostnames. Since some systems will reject invalid hostnames while others will not, the use of invalid hostname characters has caused many subtle problems in systems that connect to the wider world. For example, RFC-compliant mail servers will refuse to deliver mail for Windows computers with names containing underscores.
So, the hostname "en.wikipedia.org" is made up of the DNS labels "en", "wikipedia" and "org". Labels such as "2600" and "3com" can 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 system, an unqualified hostname such as "compsci" or "wikipedia" may be combined with default domain names in order to determine the fully qualified domain name. So, a student at Harvard may be able to send mail to "joe@compsci" and have it automatically qualified by the mail systems so that it is sent to "firstname.lastname@example.org".