A hostname is a label or name assigned to a device connected to a network to identify that device on the network. Hostnames may be simple names consisting of a single word or phrase or they may be structured names. Each hostname usually has at least one network address associated with it for routing packets for performance and various other reasons.
The alternative name for a host’s computer name or site name.
What Are Hostnames Used For?
When it comes to the Internet, a URL usually consists of a hostname, a domain name, and a top-level domain name. So, for example in the URL www.google.com, the hostname is www which shows the computer is on the World Wide Web. Google will then be the domain name, and .com will be the top-level domain.
Often, in these cases where an Internet hostname has an appended domain name, it’s referred to as a fully qualified domain name (FQDN).
Likewise, servers that host websites that are primarily used on mobile devices, have the hostname m. So, in this instance, the URL would be m.example.com.
Also, mail servers are often named based on which protocol they use, and they then receive a corresponding hostname. These can include hostnames like mail, POP3, SMTP, or IMAP.
In other cases, the hostname can even refer to a specific country. So, for example, an online store in the US might have the URL www.onlineshop.com, but in Germany, it could be de.onlineshop.com. In this way, it’s not necessary to have a new top-level domain for every country, but a business can use the hostname to make specific sites for specific countries.
For their effective use, some rules need to be followed for a hostname to be valid. These include:
- A hostname must be a single word and contain no spaces.
- It may only have letters, numbers, periods, or hyphens.
- It has a maximum length of 253 characters.
- A DNS name may be appended to a hostname.
- It can’t contain an underscore, although an appended DNS name may.
- Although not a requirement, it’s recommended to always use lowercase characters in hostnames, because some tools ignore cases and consider everything in lowercase.
Why Are Hostnames Important?
Because hostnames identify a computer on a network or the Internet, it would not be possible to access specific resources online or on a network without a hostname.