In order to provide this service for free, we may receive compensation from the sites listed. We believe in transparency.

Difference Between Hostname and Domain Name Explained

A domain name is the name you register, such as example.com. A hostname is the name of one specific machine or service, such as www or mail, and it usually sits in front of the domain, as in www.example.com. Together they form a fully qualified domain name, or FQDN.

The two terms get mixed up because people use “hostname” in more than one way. This guide explains the difference in plain language, shows how the pieces fit together in a web address, and covers how to find your own. For the full naming rules, see our guide to the fully qualified domain name.

Hostname vs Domain Name at a Glance

  • Domain name: the name you register through a registrar, such as example.com. It identifies your site or organization.
  • Hostname: the name of a single server, device, or service, such as www, mail, or a computer’s own name.
  • How they combine: short host name plus domain name gives the FQDN, such as www.example.com.
  • Who sets them: you register the domain, then you add hostnames under it yourself in your DNS settings.
  • Easy way to remember it: the domain is the building’s address, and the hostname is the room inside it.

Hostname vs Domain Name: Side by Side

Question Domain name Hostname
What it names A site or organization on the internet One server, device, or service
Example example.com www, mail, or blog
Where you get it A registrar, which reserves it for you You create it in your DNS records
Does it cost extra? Yes, you pay to register and renew it Not by itself, because it lives under a domain you already own
Can it stand alone? Yes, example.com works on its own Usually not. Without a domain, “www” alone isn’t unique
Where it sits in a FQDN The part after the first dot The part before the first dot

What Is a Domain Name?

Cloudflare defines a domain name as a string of text that maps to an IP address and is used to access a website from client software. It is the text people type into a browser to reach a site. Domain names are managed by domain registries, which delegate the reservation of names to registrars.

Read from right to left, a domain name moves from general to specific. The part after the last dot is the top-level domain, such as .com or .org. The part to its left is the second-level domain, which is the name you actually choose. In google.com, “com” is the top-level domain and “google” is the second-level domain.

What Is a Hostname?

Cloudflare’s glossary defines a hostname as the name given to a server or node on a network, often the public DNS name of a server. The word has two common uses.

  • The label for one machine or service. In www.example.com, “www” is the host name. The Linux manual page uses this meaning, describing a FQDN as a short host name plus the DNS domain name.
  • The host part of a web address. MDN’s documentation says the hostname of a URL is either its domain name or its IP address. By that meaning, the hostname of https://www.example.com/pricing is the whole name www.example.com.

That second use is why you will see “hostname” and “domain name” treated as interchangeable in some places. Both are correct in context, so check which meaning a guide or settings screen intends.

How They Fit Together

The Linux hostname manual page states that a FQDN consists of a short host name and the DNS domain name, and that the DNS domain name is the part after the first dot. The table breaks down a few examples.

Full name (FQDN) Hostname Domain name
www.example.com www example.com
mail.example.com mail example.com
blog.example.com blog example.com
example.com None. It is the apex domain, with no subdomain part example.com

Cloudflare uses the term apex domain for a domain without a subdomain part, such as example.com without www. Each hostname under your domain can point to a different server, which is how one domain can run a website, a mail server, and a blog on separate machines.

Hostname in a Web Address

A URL holds the hostname together with other parts. Cloudflare notes that a URL contains the domain name plus other information, including the protocol and the path.

Part In https://www.example.com/pricing
Protocol https
Hostname www.example.com
Domain name example.com
Path /pricing

When a settings screen asks for a hostname, enter just the name, such as www.example.com, with no https:// and no path.

How to Find a Hostname and Domain Name

  • For a website: look at the address bar. Everything between https:// and the next slash is the hostname, and the domain name is the part after the first dot.
  • On a Linux computer: run hostname to print the system’s host name, dnsdomainname to print the domain part, and hostname --fqdn for the full name.
  • On Windows: run hostname in Command Prompt for the computer name, or ipconfig /all to see its host name and DNS suffix.

The Linux manual page warns that a machine with several network interfaces may have multiple FQDNs or none at all, so results depend on your setup.

Why the Difference Matters

  • DNS records. An A record connects a hostname to an IP address, so you need the right hostname to send traffic to the right server. Our guide on how DNS works explains the records.
  • Email and server setup. Mail programs and servers often ask for a full host name such as mail.example.com, not just the domain.
  • SSL certificates. A certificate covers specific names, so list each hostname you want protected, such as www.example.com.
  • Nameservers. Your domain’s nameservers typically answer lookups for every hostname under it. See what a nameserver is for how that works.

Common Mistakes

  • Using the two terms as if they were identical. They can overlap, but a hostname usually names one machine and a domain name names the whole site.
  • Typing https:// into a hostname field. Hostname fields want the name only.
  • Forgetting that www.example.com and example.com are different names. Your DNS can send them to different places, so make sure both work or redirect one to the other.
  • Treating a hostname as something you register. You register the domain, and you create hostnames under it in DNS.

The Bottom Line

A domain name is the name you register, and a hostname names one machine or service under it. Join them with a dot and you have a fully qualified domain name such as www.example.com. When a guide uses “hostname” for the whole host part of a web address, it is using the second, broader meaning.

If you still need a name, read how to check if a domain name is available and how to buy a .com domain. Ready to build? See our HostPapa review or our top 10 web hosting providers.

Visit HostPapa · Visit Hostinger

Hostname vs Domain Name FAQs

What is the main difference between a hostname and a domain name?

A domain name is the name you register, such as example.com, and it identifies a site or organization. A hostname names one machine or service, such as www or mail, and sits in front of the domain. Joined together, as in www.example.com, they form a fully qualified domain name.

Is www a hostname?

Yes. In www.example.com, “www” is the host name, a label for the machine or service that serves the website. The domain name is example.com. The label isn’t required, and many sites also answer at the plain domain, so check that both versions work or redirect one to the other.

Is a hostname the same as an FQDN?

No. The Linux manual page describes a FQDN as a short host name plus the DNS domain name, so the hostname is one part of it. A short host name such as www becomes the FQDN www.example.com once you add the domain. In URL settings, though, people often call the full name the hostname.

Can a hostname and a domain name be the same thing?

Sometimes, depending on the meaning. MDN says the hostname of a URL is either its domain name or its IP address, so for https://example.com the hostname is example.com. In DNS terms, the apex domain has no separate host label. Context tells you which meaning a guide or setting intends.

Do I need to register a hostname?

No. You register the domain name through a registrar. You then create hostnames under it yourself by adding records in your DNS settings, such as www, mail, or blog. Adding a hostname doesn’t require a new registration, though you do need to keep renewing the domain it lives under.

How do I find my computer’s hostname?

Open a terminal or Command Prompt and run the hostname command, which prints the system’s host name. On Linux, dnsdomainname shows the domain part and hostname –fqdn shows the full name, though the manual page warns that results depend on your network configuration. On Windows, ipconfig /all shows more detail.

Is a hostname the same as a URL?

No. A URL is a full web address with a protocol, a host, and often a path, such as https://www.example.com/pricing. The hostname is only the host part, www.example.com. The domain name is example.com, the protocol is https, and /pricing is the path to a specific page.

Sources: Cloudflare’s DNS glossary and domain name guide; the Linux hostname manual page; and MDN’s URL hostname documentation. All checked December 1, 2026.

Find The Best Hosting

We made sure to cover all the most popular hosting use cases and are working daily to test and feature only the best options for you to choose from!