Also called a computer name, nodename, or sitename, a hostname is the name of a computer or device (host) on a network.
Below is an example of a hostname assigned to a computer connecting to the Internet using Comcast.
In this example, the hostname has the IP address (22.214.171.124), "CO" for Colorado, and comcast.net, which is the ISP (Internet service provider) hosting the customer. This type of hostname would be stored in a Domain Name System to help map the hostname to an address.
Local network hostname example
Another example would be a local network called "hope" with two computers on that network called "bart" and "homer." On this network, the "bart" computer has the hostname "bart.hope," and the "homer" computer has the hostname "homer.hope."
Internet hostname examples
On the Internet, a hostname is a domain name assigned to a host computer. For example, if Computer Hope had two computers on its network named "bart" and "homer," the domain name "bart.computerhope.com" connects to the "bart" computer. The IP address of the "bart" computer is obtained by looking up the hostname "bart.computerhope.com" in the host's file or DNS resolver.
With an Internet web page (e.g., computerhope.com) or Internet location, a hostname is more often called a domain name. If the domain name includes a TLD (top-level domain), the hostname is an FQDN (fully qualified domain name).
How to see a computer's hostname
There are many different ways to determine a computer's hostname. On a Microsoft Windows computer, you can open the command line and run the hostname, ipconfig /all, or net view commands.
In the Linux command line, you can run the hostname command to view and set the hostname on the computer.
Hostname rules and restrictions
Below are a few rules and restrictions for a hostname to be valid.
- A hostname is a single word with no spaces.
- A hostname may only have letters, numbers, periods, or a hyphen.
- A hostname has a maximum length of 253 characters.
- A DNS (domain name system) name may be appended to a hostname.
- The hostname cannot have an underscore. However, an appended DNS contained in the hostname may have an underscore.
- The early hostname specification in RFC 952 required that a hostname not begin with a number or hyphen character. However, this restriction was later changed in RFC 1123.
- Further recommendations on naming a computer are also on RFC 1178.
A hostname can have uppercase or lowercase characters. However, some tools and systems ignore case and consider everything lowercase. We recommend always using lowercase characters in hostnames to prevent problems or confusion.
Should I use "host name" or "hostname" in my writing?
With a computer on a network, "hostname" should be written as one word with no space unless referencing a product that uses the two-word form.
The Microsoft ipconfig, systeminfo, and other command line commands use "Host name" in the output.