How DNS works: a plain explanation
What happens when you type a web address? A simple walkthrough of DNS — domain hierarchy, resolvers, caching and TTL.
On this page
Type a web address, press Enter, and a page appears. Behind that moment is the Domain Name System (DNS) — the phonebook of the internet. This article explains how it works without jargon.
Why DNS exists
Computers talk to each other using IP addresses like 192.0.2.1 or 2606:4700::6810:84e5. Humans remember names like example.com instead. DNS translates names into addresses.
Every device connected to the internet uses DNS. It is all around you, and it runs on a strict hierarchy.
The domain hierarchy
A domain name is read from right to left:
.— the root. The topmost level; every name hangs below it.com(ororg,id,de...) — the top-level domain (TLD).example— the second-level domain you register from a registrar.www— a subdomain, often used to point at the main site.
Each level delegates authority to the next. Your registrar's DNS provider holds the records for the domain you own.
The steps behind the scene
When your browser needs example.com, this happens:
- Your device asks a recursive resolver. This is usually run by your ISP or a public service like Cloudflare 1.1.1.1 or Google 8.8.8.8.
- The resolver walks the hierarchy. It asks the root servers for
com, then thecomservers forexample.com. - The authoritative server answers. The DNS provider that hosts your domain's records returns the final answer — for example an
Arecord with an IPv4 address, or anAAAArecord with IPv6. - Your browser connects to that IP address and loads the site.
This whole journey usually takes milliseconds because of caching.
Caching and TTL
Answers are stored in memory for a limited time — the Time To Live (TTL). Your device caches the answer, and so does the recursive resolver. A shorter TTL means changes spread faster (useful when you move a site to a new server). A longer TTL means fewer queries and faster responses.
Because of caching, changing DNS records takes time to propagate — that is why people say "DNS changes can take up to 24-48 hours", even though the underlying TTL is often just minutes or hours.
Common record types
- A — maps a name to an IPv4 address.
- AAAA — maps a name to an IPv6 address.
- CNAME — an alias pointing at another name.
- MX — mail exchange, tells email where to be delivered.
- TXT — arbitrary text, used for verification and security (SPF, DKIM).
- NS — name server, states which servers are authoritative for a domain.
FAQ
What does DNS stand for and what does it do?
DNS stands for Domain Name System. It is the phonebook of the internet: it translates human-friendly domain names like example.com into the IP addresses that computers use to route traffic. Without DNS you would have to remember numbers like 93.184.216.34 instead of names.
Why do DNS changes sometimes take so long to appear?
Because of caching. Answers are stored for a limited time called the Time To Live (TTL), on both your device and the recursive resolver. A short TTL spreads changes fast; a long TTL means fewer queries but slower propagation. That is why changes can take up to 24–48 hours even when the underlying TTL is only minutes or hours.
What is the difference between an A record and a CNAME record?
An A record maps a name directly to an IPv4 address, so it carries the actual server address. A CNAME record is an alias that points a name to another name instead of an address. Because it points to another name, a CNAME cannot be combined with other records such as an MX record on the same host.
What is a recursive resolver?
A recursive resolver is a server that performs the full DNS lookup on behalf of your device. It asks the root servers for the top-level domain, then the TLD servers for the specific domain, and finally gets the authoritative answer. Your ISP or a public service such as Cloudflare 1.1.1.1 or Google 8.8.8.8 runs one for you.
Summary
DNS is a distributed directory that turns names into IP addresses. It works through a hierarchy of root, TLD and authoritative servers, with recursive resolvers doing the lookup and caches making it fast. Understanding TTL explains why record changes take time to appear.
It is one of the oldest parts of the internet, and still one of the most important.
Sources
- Cloudflare Learning Center — What is DNS? (cloudflare.com/learning/dns/what-is-dns)
- RFC 1034 — Domain Names (ietf.org/rfc/rfc1034)
Share this guide
Related guides
- What is a CDN? A plain explanation
Why web pages load fast everywhere: how content delivery networks cache files at the edge, route visitors to the nearest server, and protect sites from attacks.
- What is a proxy server and how does it work?
A plain explanation of proxy servers — forward vs reverse, what they do, the headers they add, and what they cannot protect.
- How to set up a reverse proxy with Nginx: a practical guide
A reverse proxy sits in front of your web servers and forwards client requests to them. This guide shows you exactly how to set one up with Nginx — proxy_pass, headers, load balancing, TLS and common pitfalls.