Skip to content
X

Domains and DNS

Every time google.com is typed into a browser, a behind-the-scenes lookup converts that human-readable name into a machine-readable IP address. Understanding how this works demystifies a process that is invisible yet happens billions of times every day.

Target reader: Beginners who want to understand how domain names and DNS work. Estimated time: 10 min read + 5 min hands-on Prerequisites: What Is the Internet? (recommended)

A domain name is a human-readable alias for an IP address. IP addresses like 142.250.80.46 are hard to remember. Domain names like google.com are easy to type and share.

The relationship is like a contacts list on a phone. The phone stores a number (the IP address), but the display shows a name (the domain). Looking up “Alice” in the contacts retrieves the actual phone number. DNS does the same for domain names.

A domain name is read from right to left in terms of hierarchy:

subdomain . second-level domain . top-level domain
   www    .       example        .      com
PartExampleDescription
TLD (Top-Level Domain).comThe rightmost segment; broadest category
Second-level domainexampleThe name registered by a person or organization
SubdomainwwwA prefix added by the domain owner; optional

The combination of second-level domain and TLD — example.com — is what is registered and owned.

TypeExamplesPurpose
Generic TLD (gTLD).com, .net, .org, .io, .appGeneral-purpose; .com is the most recognizable
Country Code TLD (ccTLD).jp, .uk, .de, .auTied to a specific country
Sponsored TLD.edu, .gov, .milRestricted to specific organizations
New gTLD.tech, .design, .aiIntroduced after 2012; growing in number

.io has become popular among tech startups despite being the ccTLD for the British Indian Ocean Territory, mainly because “I/O” (input/output) resonates with developers.

DNS (Domain Name System) is the global distributed database that maps domain names to IP addresses. It functions like the Internet’s phonebook.

Without DNS, every URL would need to be an IP address. DNS makes the web navigable by humans.

The DNS system is distributed — no single server stores all domain-to-IP mappings. Instead, the work is divided across a hierarchy of servers:

Root DNS Servers (13 sets worldwide)
        |
TLD DNS Servers  (.com, .net, .jp, ...)
        |
Authoritative DNS Servers  (one per registered domain)

When www.example.com is entered in a browser for the first time, the following chain of lookups occurs:

Browser
  |
  |-- Check local DNS cache (already know the IP?)
  |       YES: use cached IP immediately
  |       NO:  continue below
  |
  v
Recursive Resolver (provided by ISP or configured manually, e.g., 8.8.8.8)
  |
  |-- Query Root DNS Server
  |   "Who handles .com?"
  |   <- "Ask the .com TLD server at this address"
  |
  |-- Query .com TLD Server
  |   "Who handles example.com?"
  |   <- "Ask the authoritative server at this address"
  |
  |-- Query Authoritative DNS Server for example.com
  |   "What is the IP for www.example.com?"
  |   <- "93.184.216.34"
  |
  v
Browser connects to 93.184.216.34

The result is cached at each step for the duration specified by the domain’s TTL (Time to Live), so subsequent requests skip most of this chain.

Domain names are registered through companies called domain registrars. The registrar reserves the name in the global DNS system for a fee (typically paid annually).

Well-known registrars:

RegistrarNotes
NamecheapPopular for affordable pricing and a clean interface
Google Domains / Squarespace DomainsSimple, integrated with Google services
Cloudflare RegistrarSells at cost (no markup); includes free DNS and DDoS protection
GoDaddyOne of the largest; aggressive upselling is common

After registering, the registrar’s dashboard provides control over DNS records — the settings that tell the world where to send traffic for that domain.

Record TypePurposeExample
AMaps a domain to an IPv4 addressexample.com → 93.184.216.34
AAAAMaps a domain to an IPv6 addressexample.com → 2001:db8::1
CNAMEAlias from one name to anotherwww.example.com → example.com
MXMail server for the domainRoutes email to Google Workspace, etc.
TXTArbitrary text; used for verificationSPF, DKIM, site ownership verification

The dig command (or nslookup on Windows) queries DNS directly from the terminal:

dig example.com

The output will show the A record — the IP address the domain resolves to — along with TTL values. This is a quick way to verify that DNS is configured correctly after making changes.

  • A domain name is a human-readable alias for an IP address.
  • A domain is composed of a subdomain, second-level domain, and TLD.
  • DNS is the distributed phonebook that maps names to addresses.
  • DNS resolution follows a chain: browser cache → recursive resolver → root DNS → TLD DNS → authoritative DNS.
  • Domains are registered through registrars and managed via DNS records.

Q: What is the difference between www.example.com and example.com?

A: Technically they are different hostnames. example.com is called the “apex” or “naked” domain. www.example.com is a subdomain. Most sites configure both to serve the same content and redirect one to the other. Neither is more “correct” — it is a convention.

Q: How long does a DNS change take to propagate?

A: DNS changes propagate within the TTL period of the old record — often between a few minutes and 48 hours. When expecting to make a change, lowering the TTL to a small value (e.g., 300 seconds) a day in advance reduces the propagation window.

Q: What is a DNS resolver (like 8.8.8.8)?

A: A DNS resolver (or recursive resolver) is a server that performs the full lookup chain on behalf of a client. 8.8.8.8 is Google’s public DNS resolver; 1.1.1.1 is Cloudflare’s. These are alternatives to the default resolver provided by an internet service provider, often offering faster lookups or privacy protections.


Next: Introduction to Databases

Link to this page (Japanese): ドメインとDNS