Names are for people, numbers are for machines
Computers on a network find each other using numeric addresses, but people prefer names they can remember. The domain name system is the service that connects the two. When you type a website name into your browser, your device first has to ask, “What is the address for this name?” Only once it has an answer can it contact the right server and ask for the page.
A common comparison is a phone book: you look up a name and get a number. That is a reasonable starting picture, but the real system is spread across many computers, and answers are stored temporarily along the way so that most lookups are fast.
The lookup, step by step
Suppose you type www.example.com. Roughly this happens:
- Your device checks its own memory. Browsers and operating systems keep recent answers, so a site you visited a moment ago may not need a new lookup.
- It asks a resolver. If there is no stored answer, the device sends the question to a DNS resolver. In most homes this is a server run by the internet provider, though the router often passes the question along on your device’s behalf.
- The resolver checks its own memory. Resolvers serve many customers, so popular sites are often already stored.
- If not, the resolver works through the hierarchy. It asks a root server which servers handle the last part of the name, such as
.com. It then asks those servers which ones are responsible forexample.com, and finally asks that site’s own name server for the address ofwww. - The answer comes back and is stored. The resolver returns the address to your device, and both of them remember it for a while.
Only after step 5 does your browser open a connection to the server and request the page. All of this typically takes a small fraction of a second, although a slow or overloaded resolver can add noticeable delay to the first load of a site.
The hierarchy behind a name
Reading a name from right to left shows how responsibility is divided. In www.example.com:
comis the top-level domain, managed by one set of servers.exampleis a name registered within it, and its owner chooses which name servers answer for it.wwwis a label the owner controls, and it can point to a particular server.
Nobody has one giant list of every name. Each level only knows where to send you next, which is what lets the system scale to the whole internet.
Caching and how long answers last
Every DNS answer comes with a time limit, set by the owner of the name, often called the time to live. Until it expires, resolvers and devices can reuse the answer without asking again. Short limits let an owner move a site quickly; long limits reduce lookups.
This explains a familiar annoyance. When a website changes servers, some people see the new site immediately while others still see the old one for a while, because their stored answers have not expired yet.
More than websites
The same system handles other jobs. Email delivery depends on DNS records that say which servers accept mail for a domain. Apps on your phone look up names too, not just browsers. So a DNS problem can make many things seem broken at once, even though your connection is actually working.
When DNS goes wrong
A few typical symptoms:
- A website will not load and the browser reports that it cannot find the server, but you can still reach other sites or services using numeric addresses. That points to the lookup failing, not the connection.
- Some sites load and others don’t, which may be a resolver having trouble with certain names.
- A site loads slowly at first and quickly afterwards, which can be a slow lookup followed by cached answers.
Restarting the router, or the device, often clears out stale stored answers. If problems persist, people sometimes switch their router or device to a different resolver, such as one run by a well-known public provider. This is usually safe, but it does mean that company, rather than your provider, sees the names you look up, so it is worth reading its privacy terms first.
Privacy and safety angles
DNS lookups traditionally travel unencrypted, which means the network between you and the resolver can see which names you ask for, though not the pages you read. Encrypted forms of DNS exist and are available in many browsers and operating systems. A virtual private network also typically sends lookups through its own servers, which changes who can see them. For a broader picture of what is visible, see online privacy more generally.
DNS also matters for safety. Scammers register names that closely resemble real ones, and these lookalike domains resolve perfectly well like any other. A name that looks nearly right is no guarantee that the site is genuine, so it is worth checking the spelling carefully before entering any details.
Some networks and countries also block sites at the DNS level by refusing to answer or giving a false answer, one of several methods used in internet censorship. That kind of block can sometimes be avoided by using a different resolver, though the legality and risks of doing so vary by place.
The takeaway
DNS is invisible when it works. It is a lookup service that turns the name you type into an address, using layers of servers and a lot of stored answers to keep it fast. When pages refuse to load but the connection otherwise seems fine, it is one of the first places worth checking. It is also part of why the World Wide Web is usable at all, since nobody would be able to remember the number for every site.