Type something to search...
What is a domain name and how does it work?

What is a domain name and how does it work?

A domain name is the human-readable address of a website or online service, such as example.com. Computers find each other using numeric IP addresses like 104.20.23.154, which are hard to remember and can change, so the Domain Name System (DNS) translates the name into the right IP address whenever someone visits your site or sends you an email. You don't buy a domain name outright: you register the right to use it for a period, usually one to ten years, through a domain registrar, and you keep it for as long as you keep renewing it.

Domain names are so familiar that most people never think about what's behind them. This article explains how a domain name is structured, who manages each part, what happens when someone types your domain into a browser, what you actually get when you register one, and how the domain connects to your website and email.

What Is a Domain Name?

A domain name is a unique name registered in the global DNS. It acts as a stable label that points to whatever services you choose: a website, an email provider, an app, or nothing at all.

The key benefits of using a name rather than an IP address are:

  • It's memorable: People can remember example.com far more easily than 2606:4700:10::6814:179a.
  • It's portable: If you move your website to a new host, the IP address changes but your domain name stays the same. You update one DNS record and visitors follow.
  • It's an identity: Your domain appears in your website address, your email addresses, and your brand. It's one of the few online assets that you control rather than a platform.
  • It's a trust signal: Services such as email providers, certificate authorities, and search engines all use the domain to decide who you are.

The Structure of a Domain Name

Domain names are read from right to left, with each part separated by a dot. Each part is called a label.

Take blog.shop.example.co.uk as an example:

PartLabelName
RightmostukTop-level domain (TLD)
NextcoSecond-level domain under .uk (here part of the registry's structure)
NextexampleThe registered name
NextshopSubdomain
LeftmostblogSubdomain of shop

For a simpler domain such as www.example.com:

  • .com is the top-level domain (TLD), sometimes called the domain extension.
  • example is the second-level domain, the part you choose and register.
  • www is a subdomain, which you create yourself in DNS at no extra cost.

There's also an invisible part at the far right: the root, written as a trailing dot. The fully written-out form www.example.com. is known as a fully qualified domain name. Browsers hide the trailing dot, but DNS always works from the root downwards.

Rules for Domain Labels

Every label must follow a few technical rules:

  • Labels can contain letters a to z, digits 0 to 9, and hyphens.
  • A label can't start or end with a hyphen.
  • Each label can be up to 63 characters, and the full name up to 253 characters.
  • Domain names are case-insensitive: Example.COM and example.com are the same domain.

Names in other scripts, such as Arabic, Chinese, or accented Latin characters, are supported through an encoding system. You can read more in our guide to internationalized domain names.

Types of Top-Level Domains

The TLD on the right of your domain falls into one of a few broad groups:

  • Generic TLDs (gTLDs): The original extensions such as .com, .net, and .org, open to anyone.
  • Country-code TLDs (ccTLDs): Two-letter extensions tied to countries and territories, such as .uk, .de, .ca, and .au. Some have residency requirements.
  • New gTLDs: Hundreds of extensions added since 2013, such as .app, .shop, .blog, and .dev.
  • Sponsored and restricted TLDs: Extensions limited to specific communities, such as .gov, .edu, and .museum.

The differences, and how they affect your choice, are covered in gTLDs vs ccTLDs vs new TLDs.

Who Manages Domain Names?

Several organisations share responsibility for the domain name system. Understanding who does what makes it much easier to know where to go when something needs changing.

OrganisationRoleExample
ICANN and IANACoordinate the root zone and set policy for generic TLDsApproving new TLDs, accrediting registrars
RegistryRuns one or more TLDs and keeps the master database of namesVerisign for .com and .net
RegistrarSells registrations to the public and submits them to the registryNamecheap, Cloudflare Registrar, Porkbun
RegistrantThe person or organisation that holds the domainYou
DNS hostServes the DNS records for your domainYour registrar, Cloudflare, Route 53

You only ever deal with the registrar and your DNS host directly. The registrar handles the registry for you. For a deeper look at the policy side, see what ICANN does, and for choosing a company to register with, see what a domain registrar is.

How a Domain Name Works

When someone types example.com into a browser, a short chain of lookups happens behind the scenes, usually in a few milliseconds.

  1. The browser checks its cache: If it looked up the name recently, it reuses the answer.
  2. The operating system asks a recursive resolver: This is usually run by your internet provider, or a public service such as Google (8.8.8.8) or Cloudflare (1.1.1.1).
  3. The resolver asks a root server: The root servers don't know the answer, but they know which servers are responsible for .com.
  4. The resolver asks the TLD servers: The .com servers don't know the IP either, but they know which nameservers are authoritative for example.com. This delegation is what your registrar sets when you choose nameservers.
  5. The resolver asks the authoritative nameservers: These hold your actual DNS records and return the IP address.
  6. The browser connects: It contacts the web server at that IP, and the site loads.

The resolver caches each answer for the time set in the record's TTL, so most lookups never need to go all the way back to the root. If you want the full detail, our guides on what DNS is and TLD name servers go deeper.

Seeing the Lookup Yourself

You can watch this chain happen with the dig command, available on macOS and Linux. The +trace option makes dig start at the root and follow each referral:

dig +trace example.com A

The output is long, but it follows the same steps as above. Shortened, it looks like this:

.                       518400  IN  NS  a.root-servers.net.
.                       518400  IN  NS  b.root-servers.net.
;; Received 239 bytes from 192.168.1.1#53(192.168.1.1) in 12 ms

com.                    172800  IN  NS  a.gtld-servers.net.
com.                    172800  IN  NS  b.gtld-servers.net.
;; Received 1170 bytes from 198.41.0.4#53(a.root-servers.net) in 20 ms

example.com.            172800  IN  NS  elliott.ns.cloudflare.com.
example.com.            172800  IN  NS  hera.ns.cloudflare.com.
;; Received 331 bytes from 192.5.6.30#53(a.gtld-servers.net) in 28 ms

example.com.            300     IN  A   104.20.23.154
;; Received 56 bytes from 108.162.192.162#53(hera.ns.cloudflare.com) in 85 ms

Each block is one step: the root points to .com, .com points to the domain's nameservers, and those nameservers give the final answer. For everyday checks, a short query is enough:

dig +short example.com A
dig +short example.com NS

If dig is new to you, our dig guide covers the most useful options.

Resolving a Domain in Code

Every programming language can resolve a domain name using the operating system's resolver. In Python:

import socket

def resolve(domain: str) -> list[str]:
    results = socket.getaddrinfo(domain, 443, proto=socket.IPPROTO_TCP)
    return sorted({r[4][0] for r in results})

for name in ["example.com", "www.example.com"]:
    print(name, resolve(name))
example.com ['2606:4700:10::6814:179a', '104.20.23.154']
www.example.com ['2606:4700:10::6814:179a', '104.20.23.154']

The exact addresses you see will depend on where the domain is hosted at the time.

Domain Names, DNS Records, and Services

A domain on its own doesn't do anything. It becomes useful when you add DNS records that point it at services. The most common records are:

  • A and AAAA: Point a name at an IPv4 or IPv6 address, usually a web server.
  • CNAME: Make one name an alias of another, often used for www or for services such as a store platform.
  • MX: Tell other mail servers where to deliver email for your domain.
  • TXT: Hold text such as SPF policies and verification tokens.
  • NS: List the nameservers responsible for the domain or a delegated subdomain.

A small zone for a business domain might look like this:

$ORIGIN example.com.
$TTL 3600
@       IN  NS     ns1.dnshost.example.
@       IN  NS     ns2.dnshost.example.
@       IN  A      203.0.113.10
www     IN  CNAME  example.com.
@       IN  MX     10 mail.mailprovider.example.
@       IN  TXT    "v=spf1 include:_spf.mailprovider.example ~all"

This is why the domain and the services behind it are separate things. You can keep the same domain for years while switching web hosts, email providers, and DNS providers underneath it. The difference between the name and the place your site lives is explained in domain name vs web hosting.

What You Get When You Register a Domain

When you register a domain, you get:

  • Exclusive use of the name for the registration period, which is typically 1 to 10 years.
  • The right to renew before it expires, usually at the registrar's standard renewal price.
  • Control over its nameservers, which decides where its DNS records are hosted.
  • The ability to transfer it to another registrar or to another person, subject to registry and registrar rules.

What you don't get is permanent ownership. A domain is closer to a renewable lease. If you stop paying, it eventually expires, goes through grace and redemption periods, and is released for someone else to register. Our guide on what happens when a domain expires walks through that timeline.

You also don't get automatic rights to a trademark. Registering a name that infringes someone else's trademark can lead to the domain being taken from you through a dispute process.

Checking Who Holds a Domain

Every registered domain has a public registration record held by the registry. Today the standard way to query it for generic TLDs is RDAP, which returns structured JSON:

curl -s https://rdap.org/domain/example.com | jq '{name: .ldhName, status, events}'
{
  "name": "EXAMPLE.COM",
  "status": [
    "client delete prohibited",
    "client transfer prohibited",
    "client update prohibited"
  ],
  "events": [
    { "eventAction": "registration", "eventDate": "1995-08-14T04:00:00Z" },
    { "eventAction": "expiration", "eventDate": "2027-08-13T04:00:00Z" }
  ]
}

The output above is shortened, and the dates you see will reflect the domain's current registration. The full response shows the registration date, the expiry date, the registrar, and the domain's status codes. Personal contact details are usually redacted for privacy. See what RDAP is for more on reading these responses.

Common Misconceptions About Domain Names

A few misunderstandings come up again and again:

  • "My domain and my website are the same thing." They're separate. The domain points to the website, and either can change without the other.
  • "I own my domain forever." You hold it while you renew it. Missing a renewal can mean losing it.
  • "Subdomains cost extra." They don't. Once you've registered example.com, you can create shop.example.com, blog.example.com, and as many others as you like in DNS. See how to set up a subdomain.
  • "The www is required." It isn't. www is just a conventional subdomain. Many sites redirect one form to the other so both work.
  • "Changing DNS changes instantly everywhere." Resolvers cache answers based on the TTL, so changes can take minutes to hours to reach everyone.

FAQ: Domain Names

example.com is a domain name. The .com part is the top-level domain and example is the second-level domain you register. An address such as www.example.com or shop.example.com uses a subdomain of that domain.

No. A URL is a full web address that includes the protocol, the domain name, and often a path, such as https://www.example.com/pricing. The domain name is just the example.com part.

No. Domains are registered for a fixed term, usually between one and ten years, and must be renewed. You can keep a domain indefinitely by renewing it on time, and auto-renew makes this easier.

No. An IP address is the numeric address of a server. A domain name is a readable label that DNS translates into one or more IP addresses, and the IP behind a domain can change without the domain changing.

No. You can register a domain without any website or hosting. Many people register domains to reserve a name, use them only for email, or redirect them to another site.

No. DNS treats uppercase and lowercase letters as identical, so Example.com and example.com are the same domain. Paths after the domain in a URL can be case-sensitive, depending on the web server.


Conclusion

A domain name is a readable, portable address that sits in front of your website, email, and other online services. It's structured from right to left, from the root to the top-level domain to the name you registered and any subdomains you create, and DNS resolves it into IP addresses through a chain of root, TLD, and authoritative nameservers.

When you register a domain, you're renting exclusive use of the name for as long as you renew it. Keep the domain separate in your mind from hosting and DNS, protect the registrar account that controls it, and turn on auto-renew. With those basics in place, your domain can stay with you for as long as your business does, even as everything behind it changes.

Tags :
Share :

Related Posts

.com vs .net vs .org: which domain extension should you choose?

.com vs .net vs .org: which domain extension should you choose?

For most businesses, .com is the best choice: it's the extension people type by default, the one they trust most, and the one email users assume

Dive Deeper
Do new domain extensions like .io, .dev, and .ai affect SEO?

Do new domain extensions like .io, .dev, and .ai affect SEO?

No, new domain extensions like .io, .dev and .ai don't directly help or hurt your Google rankings. Google has said it treats new generic TLDs t

Dive Deeper
What is the difference between a domain name and web hosting?

What is the difference between a domain name and web hosting?

A domain name is the address people type to reach your website, such as example.com, while web hosting is the server space where your website's fil

Dive Deeper