What is DNS?

DNS (the Domain Name System) is the internet's phone book. It turns a name like example.com into the IP address a computer needs to connect, by asking a chain of servers and caching the answer for a set time.

See why DNS changes take time

How DNS works: step through a lookup

Pick a scenario and press Next step to follow a fictional lookup for assistant.example.com. Compare a cold lookup, a cached answer and a name that does not exist.

Nothing is cached, so the resolver asks the root, the .com TLD and the authoritative server in turn.

  1. Your browser
  2. Recursive resolver
  3. Root server
  4. .com TLD server
  5. Authoritative server

Step 1 of 8: Your browser Recursive resolver

Where is assistant.example.com? Your device asks the resolver set by your router or ISP, such as 1.1.1.1 or 8.8.8.8.

Change a record and watch the TTL

The resolver just cached the old address. Change the A record, then advance the clock to see when visitors reach the new server. This is why a moved site can look broken for a while.

Time since cached: 0 seconds
Authoritative server says
203.0.113.10
Resolver answers visitors with
203.0.113.10
Cached, 1 h of TTL left

The resolver cached assistant.example.com → 203.0.113.10. Change the A record to move the site to a new server.

Tip: before moving a server, lower the record's TTL to 300 seconds and wait out the old TTL. Then the switch reaches most visitors within five minutes.

Common DNS record types

TypeWhat it doesExample
APoints a name to an IPv4 addressassistant.example.com → 203.0.113.10
AAAAPoints a name to an IPv6 addressassistant.example.com → 2001:db8::10
CNAMEMakes one name an alias of anotherwww.example.com → example.com
MXNames the mail servers for a domainexample.com → mail.example.com
TXTHolds text, often for verification, SPF or DKIMexample.com → "v=spf1 include:_spf.example.net ~all"
NSNames the authoritative servers for a zoneexample.com → ns1.example.com

Frequently asked questions

What is DNS in simple terms?

DNS (Domain Name System) is the internet's phone book. It turns names people can remember, such as example.com, into the IP addresses computers use to connect, such as 203.0.113.10.

How does DNS work step by step?

Your device asks a recursive resolver. If the resolver has no cached answer, it asks a root server, which refers it to the top-level domain (TLD) servers such as .com. The TLD servers refer it to the domain's authoritative name server, which returns the IP address. The resolver caches the answer and passes it back to your device.

What is a DNS server?

"DNS server" can mean two things. A recursive resolver, run by your ISP or a provider like Cloudflare (1.1.1.1) or Google (8.8.8.8), looks up answers for you. An authoritative name server holds the actual records for a domain and answers questions about it.

What is TTL in DNS?

TTL (time to live) is how many seconds a resolver may cache a DNS answer. With a TTL of 3600, resolvers can keep returning an old address for up to an hour after you change it. Lower the TTL a day before moving a server so the change spreads faster.

Why do DNS changes take time to propagate?

DNS changes do not push out to the internet. Each resolver keeps its cached answer until the TTL expires, then asks again. Different resolvers cached the record at different times, so the new address appears gradually, usually within the old TTL.