What Your Computer Does Before a Website Even Starts Loading
You type a web address, hit enter, and a page shows up. Before a single byte of that page arrives, though, your computer has to answer a much more basic question: where is this thing? Computers don't find each other by name. They find each other by IP address, a number like 93.184.215.14 or a longer IPv6 one. DNS is the system that turns the name you typed into that number.
People call it the phone book of the internet, and that's close enough to get started. But it's not one big book sitting somewhere. It's a chain of servers that each know a small piece of the answer, and the clever part is how they pass you along.
Here's the trip, step by step, for something like www.example.com.
Step 1: Check the places nearby
Your computer doesn't go out to the internet right away. First it checks whether it already knows the answer. Your browser keeps a little cache of recent lookups. So does your operating system. On most systems there's also a hosts file that can hard-code a name to an address, which is mostly used by developers and ad blockers these days.
If any of those have a fresh answer, you're done. That's why the second visit to a site often feels a touch snappier.
Step 2: Ask the resolver
If nothing local knows, your computer asks a recursive resolver. This is the server that does the real legwork on your behalf. By default it's usually run by your internet provider, handed to your router automatically. Plenty of people swap it for a public one like Cloudflare's 1.1.1.1, Google's 8.8.8.8 or Quad9.
The resolver has its own cache, shared by everyone who uses it. Popular names are almost always already in there. But let's assume this one isn't, so the resolver has to go find out.
Step 3: Start at the root
The resolver asks a root server. The root servers don't know where www.example.com is. What they know is who's in charge of .com. So the answer is basically "I don't know, but go ask these servers over here."
Step 4: Ask the TLD servers
Next stop is the servers for the top-level domain, .com in this case. They also don't know the final address. They know which name servers the owner of example.com told their registrar to use. Another referral: "go ask those."
Step 5: Ask the authoritative server
Now the resolver asks the domain's own name servers, the authoritative ones. These are the servers where the domain owner actually keeps their records. Maybe that's their registrar, maybe Cloudflare, maybe their hosting company. This server finally gives a real answer: www.example.com is at such-and-such address.
Step 6: Cache it and hand it back
The resolver passes the answer back to your computer and keeps a copy. Your computer keeps a copy too. Then your browser opens a connection to that IP address, and only now does the actual website part begin.
All of that usually takes a few milliseconds, and most of the time steps 3 through 5 are skipped entirely because someone else already asked recently.
TTL, or why DNS changes "take time to propagate"
Every DNS record comes with a TTL, short for time to live. It's a number of seconds that says how long anyone is allowed to cache the answer. A TTL of 3600 means resolvers can hang on to it for an hour before checking again.
This is the whole reason behind the classic "DNS changes can take up to 48 hours" warning. Nothing is propagating anywhere. When you change a record, the authoritative server has the new answer immediately. It's just that resolvers around the world are still holding the old one until their cached copy expires. If you know you're about to move a site, drop the TTL to something short like 300 a day or so ahead. Then when you make the switch, the old answer falls out of caches quickly.
A few record types worth knowing
You don't need to memorize these, but you'll run into them:
- A: a name points to an IPv4 address.
- AAAA: same thing for IPv6.
- CNAME: this name is an alias for another name. Go look that one up instead.
- MX: where email for the domain should be delivered.
- TXT: free-form text, used for things like email authentication and proving to services that you own the domain.
- NS: which servers are authoritative for the domain.
Look it up yourself
If you want to see this happen, dig is the tool. It's on macOS and most Linux systems already.
dig www.example.com
That shows you the answer and the TTL. If you want to watch the whole chain from root to authoritative server, add +trace:
dig +trace www.example.com
On Windows, nslookup www.example.com gives you the basic version.
Why any of this matters to you
Two practical things. First, when "the internet is down" but some apps still work, it's often DNS. Your connection is fine, your computer just can't turn names into addresses. Switching resolvers or restarting your router fixes a surprising number of these.
Second, classic DNS queries are sent in plain text, so whoever runs your network can see every name you look up. DNS over HTTPS (DoH) and DNS over TLS wrap those lookups in encryption, and most modern browsers and operating systems support them now. It's a setting worth turning on, and it takes about thirty seconds to find.

Comments