4 min read3 sourcesUpdated

What Is DNS and How Does It Work?

How DNS turns a name like example.com into an IP address, step by step, and why caching makes it fast.

TL;DR

  • DNS (Domain Name System) is the internet's naming system: it turns a human-friendly name like mozilla.org into the numeric IP address that computers use.
  • Your device asks a DNS server called a resolver, which finds the answer by asking other servers in a hierarchy.
  • Answers are cached so repeat visits are fast, which is also why changes to a domain can take a while to spread.
  • DNS only finds the address. It does not load the page or encrypt anything.

What DNS does #

Computers reach each other using IP addresses, which are strings of numbers such as 192.0.2.172. Those are hard to remember and can change, so people use domain names like mozilla.org instead [1]. DNS is the system that keeps the list of names and the things attached to them, mainly IP addresses [2].

A good analogy is the contacts app on your phone. You tap "Sam", and the phone dials the number behind that name. DNS does the same job for websites: you type a name, and DNS supplies the number.

DNS was designed to replace a single shared file of names that every computer had to download. Instead, the data is spread across many servers, each responsible for its own part of the whole [3].

How a DNS lookup works #

When you type a web address, roughly this happens:

  1. Your browser checks its own memory. If it already knows the address from a recent visit, it connects straight away [1].
  2. If not, your device asks a resolver. A resolver is a program that asks name servers questions on your behalf and keeps following pointers until it has an answer [3]. It is often run by your internet provider, though you can choose a public one.
  3. The resolver works down the hierarchy. In practice it asks a server at the top of the tree (the root), which points it to the servers for the ending, such as .com. Those point it to the authoritative server, the one that holds the official records for that exact domain [3].
  4. The IP address comes back. The resolver hands it to your browser, which then asks that address for the page [1].
A browser asks a resolver for a name, the resolver asks the root server, then the dot-com server, then the site's own server, and the IP address travels back to the browser
A DNS lookup: the resolver asks the root, then the .com servers, then the domain's own server, and returns the IP address. (tap or click the image to open it full size)

All of this normally finishes in a small fraction of a second, before the page itself begins to load.

Reading a domain name #

A domain name is read from right to left. Each part between dots is a label, and the rightmost is the top-level domain (TLD), such as .com or .org [1].

NameWhat it is
orgThe top-level domain
mozilla.orgThe domain you register
developer.mozilla.orgA subdomain the owner created under it

The tree structure is the reason DNS scales: each level only needs to know who is in charge of the next level down [3]. You do not buy a domain outright. You pay a registrar for the right to use it for a period of time, and you can renew it [1].

Caching and TTL #

Asking the whole hierarchy every time would be wasteful, so resolvers remember answers. Each record carries a TTL (time to live), a limit on how long a copy may be reused before it must be checked again [3]. The authoritative data is always the official version, and cached copies are only as fresh as their TTL allows.

This explains why a change to a domain, such as moving a website to a new server, can take some time to appear everywhere: different resolvers refresh their copies at different moments [1].

DNS can also run in reverse, finding the name that belongs to an IP address [2].

FAQ #

What is DNS in simple terms? #

It is the internet's phone book. It matches a name you can remember to the number computers need to connect.

What is a DNS resolver? #

A resolver is the helper that does the asking for you. It queries other DNS servers, follows their pointers, and returns the final answer to your device [3].

Why does a DNS change take time to show up? #

Resolvers keep copies of answers for the length of the record's TTL. Until those copies expire, some users may still be sent to the old address [1][3].

Does DNS load the website? #

No. DNS only supplies the address. Your browser then contacts that address to fetch the page [1].

Sources #

All sources accessed 2026-10-27.

  1. Understanding domain names. MDN Web Docs, Mozilla. https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Web_mechanics/What_is_a_domain_name
  2. DNS (glossary). MDN Web Docs, Mozilla. https://developer.mozilla.org/en-US/docs/Glossary/DNS
  3. RFC 1034: Domain Names - Concepts and Facilities. IETF. https://www.rfc-editor.org/rfc/rfc1034.html