How DNS Works
Turning names people remember into addresses computers understand.
Every time you visit a website, your device first has to answer a simple question: which computer should this request go to? The system that answers that question is the Domain Name System, or DNS.
Names versus numbers
Computers find each other using IP addresses — strings of digits such as
203.0.113.10 for the older IPv4 style, or longer values like
2001:db8::1 for IPv6. People, on the other hand, are good with names such as
example.com. DNS is the bridge between the two. It works a little like a phone
book: rather than memorising numbers, you look a name up.
A phone book with no single copy
There is no master list of every domain on one machine. Instead, DNS is spread across millions of servers that cooperate. Three layers matter for most lookups:
- Root servers — a small, well-known set that know where each top-level
domain (like
.comor.org) lives. - Top-level domain servers — they know which name servers are responsible for a particular domain.
- Authoritative name servers — the ones that hold the actual records for a domain and give the definitive answer.
The lookup, step by step
- Your device asks a resolver — usually run by your internet provider or a public service.
- The resolver checks its own cache. If it has a recent answer, it replies immediately.
- If not, it asks a root server, which points it toward the right top-level domain server.
- That server points to the domain's authoritative name server.
- The authoritative server returns the address; the resolver caches it and hands it back, and your connection can begin.
All of this typically happens in well under a second — often before you have finished lifting your finger from the Enter key.
Caching, and the meaning of TTL
Every answer carries a time to live, or TTL — a number of seconds that the answer may be reused before it must be looked up again. A short TTL means changes to a domain spread quickly, at the cost of more lookups. A long TTL reduces traffic but means changes take longer to be seen everywhere.
Common record types
A— maps a name to an IPv4 address.AAAA— maps a name to an IPv6 address.CNAME— says "this name is an alias for that other name."MX— lists the mail servers that accept email for a domain.TXT— free-form text, often used to verify ownership or to publish email security settings.
Why it matters
DNS sits in front of almost everything you do online, which makes it quietly powerful and quietly fragile. When lookups fail, the internet tends to feel broken even though most of it is still running — which is why "have you tried flushing your DNS cache?" is such a common piece of advice.