Quick answer

A hostname is the host name in a URL, such as example.com in https://example.com/learn. It may contain a domain name and additional labels such as www or learn.

Original example

Compare three safe addresses

The hostnames in https://example.com/, https://learn.example.com/, and https://example.org/tools/ are example.com, learn.example.com, and example.org. Paths such as /tools/ are not part of the hostname.

Where the hostname appears

For HTTP and HTTPS URLs, the hostname follows the scheme and two slashes, and ends before a port, path, query, or fragment.

Browsers normalize hostname case. Correctly identifying a registrable domain or suffix requires more knowledge than splitting the hostname at dots.

Common misunderstandings

  • A hostname does not include the protocol or path.
  • Not every label before a dot is safely classified as a subdomain by simple string splitting.

Related answers

Sources

This is an unreviewed preview draft. Corrections can be sent after the owner configures a verified contact address.