Tech, Explained

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:

The lookup, step by step

  1. Your device asks a resolver — usually run by your internet provider or a public service.
  2. The resolver checks its own cache. If it has a recent answer, it replies immediately.
  3. If not, it asks a root server, which points it toward the right top-level domain server.
  4. That server points to the domain's authoritative name server.
  5. 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

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.