What is DNS?

DNS (Domain Name System) is a hierarchical, distributed database that maps human-readable domain names (like github.com) to machine-readable IP addresses (like 140.82.121.4). It is often called the "phone book of the internet".

Without DNS, you would need to memorise the IP address of every website you visit. DNS lets you use names while computers use numbers — and it does this globally, at scale, handling trillions of queries every day.

How DNS Resolution Works (Step by Step)

When you type www.example.com in your browser, here is what happens:

  1. Browser cache: The browser checks its own DNS cache. If it recently resolved this domain, it uses the cached IP and stops here.
  2. OS cache / hosts file: If not cached, the OS checks /etc/hosts (Linux/Mac) or C:\Windows\System32\drivers\etc\hosts (Windows), then its own DNS cache.
  3. Recursive resolver: If still unresolved, the OS contacts the configured DNS resolver (e.g. 8.8.8.8 for Google, 1.1.1.1 for Cloudflare). This resolver does the hard work on your behalf.
  4. Root nameserver: The resolver asks a root nameserver "who handles .com domains?" — root servers return the address of the TLD nameserver.
  5. TLD nameserver: The resolver asks the .com TLD nameserver "who handles example.com?" — it returns the authoritative nameserver for that domain.
  6. Authoritative nameserver: The resolver asks example.com's authoritative nameserver for the IP address of www.example.com — this is the final, definitive answer.
  7. Response cached & returned: The resolver caches the answer (for the duration of the TTL) and returns the IP address to your browser. The browser connects to that IP.
Full DNS resolution timeline Browser → Recursive Resolver → Root NS (.com?) → TLD NS (example.com NS?) → Authoritative NS (www IP?) → Answer

DNS Record Types Explained

DNS records store different types of information about a domain. Each record type serves a specific purpose:

Record TypePurposeExample
AMaps domain to IPv4 addressexample.com → 93.184.216.34
AAAAMaps domain to IPv6 addressexample.com → 2606:2800:220:1:248:1893:25c8:1946
CNAMEAlias — points domain to another domainwww.example.com → example.com
MXMail exchange — where to deliver emailexample.com → mail.example.com (priority 10)
TXTFree-form text — used for SPF, DKIM, verification"v=spf1 include:_spf.google.com ~all"
NSNameserver — which servers are authoritative for this domainexample.com → ns1.dnsprovider.com
SOAStart of Authority — metadata about the zoneSerial number, refresh interval, admin email
PTRReverse DNS — maps IP to domain name93.184.216.34 → example.com
SRVService record — port + protocol for a service_sip._tcp.example.com → priority weight port target

What is DNS TTL?

Every DNS record has a TTL (Time to Live) — a number of seconds that resolvers should cache the record before re-querying. Common TTL values:

  • 300 seconds (5 min): Used before migrations — changes propagate quickly
  • 3600 seconds (1 hour): Good balance for most records
  • 86400 seconds (24 hours): Very stable records like MX that rarely change

💡 Pre-Migration TTL Tip

Before changing a DNS record, lower the TTL to 300 seconds at least 24 hours before the change. After the change is live and verified, restore the TTL to its normal value. This minimises downtime during the transition.

Public DNS Resolvers

Your ISP provides a default DNS resolver, but you can configure any public resolver. Popular options:

ProviderPrimarySecondaryKnown For
Google8.8.8.88.8.4.4Reliability, global coverage
Cloudflare1.1.1.11.0.0.1Fastest avg response time, privacy
Quad99.9.9.9149.112.112.112Blocks malicious domains
OpenDNS208.67.222.222208.67.220.220Content filtering options

DNS vs HTTPS — What's the Difference?

DNS and HTTPS solve different problems:

  • DNS translates domain names to IP addresses — it's a lookup service
  • HTTPS encrypts the data exchanged between your browser and the server

DNS by default is unencrypted — your ISP can see every domain you look up. DNS over HTTPS (DoH) and DNS over TLS (DoT) encrypt DNS queries for privacy.

Common DNS Issues and How to Debug

Check DNS resolution from command line

Linux / Mac dig example.com A # A record lookup dig example.com MX # MX record lookup dig @8.8.8.8 example.com A # Query Google's DNS specifically nslookup example.com # Basic lookup (Windows/Mac/Linux)
Windows nslookup example.com nslookup -type=MX example.com

Common problems

  • DNS propagation delay: Record changed but old IP still resolving — wait for TTL to expire or use a different resolver to test
  • NXDOMAIN error: Domain does not exist — typo in domain name, or nameservers not configured
  • Wrong MX record: Email not delivering — check MX records and ensure they point to the correct mail server
  • CNAME at root: Cannot use CNAME for apex domain (e.g. example.com) — use A record or ALIAS/ANAME if your provider supports it

⚠️ DNS is Not Instant

When you buy a new domain or change nameservers, it can take 24–48 hours for all resolvers worldwide to pick up the change. This is normal. Use a DNS propagation checker to see which resolvers have updated.

Check DNS Propagation in Real Time

See how your DNS records look across 10 global resolvers — Google, Cloudflare, Quad9 and more.

Use DNS Propagation Checker →

How We Research and Update This Guide

We test the underlying formula or workflow, compare outputs with reliable references, and revise examples whenever the page content changes.

  • The workflow or formula is tested directly in the tool and compared against independent reference examples.
  • Examples are kept practical so readers can verify the result without hidden assumptions.
  • Pages are revised whenever the interface, calculation flow, or surrounding guidance materially changes.

Frequently Asked Questions — DNS