LineLapse BlogMake your own →
← All posts

How does DNS turn a name into an address?

#dns#networking#internet#web

Every time you type a name into a browser, something has to translate that name into an address a computer can actually route packets to. That translation is DNS — the Domain Name System — and despite handling almost every request on the internet, it works less like a single phone book and more like a chain of increasingly specific referrals.

How DNS Worksnames → numbers, explainedDNSthe internet's phone bookYouLocal CacheCache Hit!ResolverRoot Server1TLD Server2.com .org .inAuthoritative3IP AddressConnected!Cached!
▶ Watch it draw

Names for us, numbers for machines

Computers find each other using IP addresses — numbers like 93.184.216.34. Nobody wants to memorize those, so we use names like example.com instead. DNS exists purely to bridge that gap: given a name, hand back the number that belongs to it. Every other piece of DNS — the servers, the caching, the whole hierarchy — is in service of answering that one question quickly and correctly, billions of times a day.

The domain name is a hierarchy, read right to left

www.example.com looks like one string, but DNS treats it as a chain of authority, read from the right. The rightmost part, .com, is a top-level domain (TLD). example is a domain registered under it. www is a specific host within that domain. Each link in that chain is managed by a different party, and each one only needs to know where to send you for the next link — not the final answer.

The lookup: a chain of referrals

When your computer needs an IP address, it doesn't usually do the legwork itself. It asks a recursive resolver — often run by your ISP or a public service — to find the answer on its behalf. If that resolver doesn't already have the answer cached, it starts at the top of the hierarchy:

  1. It asks a root server, which doesn't know the answer either, but knows which servers handle .com domains, and points there.
  2. It asks that TLD server, which doesn't know the final IP, but knows which server is authoritative for example.com, and points there.
  3. It asks that authoritative server — the one place that actually holds the record for example.com — and gets the real answer back.

The resolver hands that IP address to your browser, and the whole chain, which sounds slow described this way, typically finishes in well under a tenth of a second.

Why it's usually much faster than that

Nobody wants to walk the full chain for every request, so DNS leans hard on caching at every step. Each answer comes with a TTL (time to live) — a number of seconds it's safe to reuse before asking again. Your browser, your operating system, and your resolver all cache answers locally, so most lookups never leave your own machine, and the ones that do often stop at the resolver's cache instead of walking all the way to the root.

Records: more than just addresses

A domain's authoritative server doesn't just store one type of answer — it stores a set of records, each doing a different job. An A record maps a name to an IPv4 address (AAAA does the same for IPv6). A CNAME record says "this name is really just an alias for that other name," which is how a company can point blog.example.com at a hosting provider without owning its IP. An MX record says which servers handle email for the domain. DNS is really a general-purpose lookup system that happens to be best known for one particular kind of answer.

When it goes wrong

Because so much depends on this one lookup, DNS problems tend to look like much bigger problems than they are. A misconfigured record can make a working server look like it doesn't exist. A TTL set too high means a fix takes hours to reach everyone, because caches everywhere are still holding the old answer. And DNS traffic traveling in plain text is also why extensions like DNSSEC and encrypted DNS exist — to stop someone in the middle from lying about where a name should send you.

The takeaway

DNS turns a name you can remember into a number a machine can route to, by walking a hierarchy of servers that each know only the next step — root, then TLD, then authoritative — and then caching the answer so almost nobody has to walk that whole chain twice. It's one of the quietest, most-used systems on the internet, and almost nobody thinks about it until it breaks.


This explainer was made with LineLapse — type a topic, get a hand-drawn video. Make your own →