πŸ“ Tutorials
Β· 3 min read
Last updated on

What is DNS? A Simple Explanation for Developers


DNS (Domain Name System) translates human-readable domain names into IP addresses. When you type google.com, DNS figures out that means 142.250.185.78 and sends your request there.

It’s the phone book of the internet.

How it works (simplified)

  1. You type example.com in your browser
  2. Your computer asks a DNS resolver: β€œWhat’s the IP for example.com?”
  3. The resolver checks its cache. If not cached, it asks the root servers β†’ .com servers β†’ example.com’s nameservers
  4. The nameserver responds: β€œIt’s 93.184.216.34”
  5. Your browser connects to that IP address
  6. The result is cached so the next request is instant

This whole process takes milliseconds.

DNS record types

RecordWhat it doesExample
AMaps domain to IPv4 addressexample.com β†’ 93.184.216.34
AAAAMaps domain to IPv6 addressexample.com β†’ 2606:2800:220:1:...
CNAMEAlias to another domainwww.example.com β†’ example.com
MXMail serverexample.com β†’ mail.example.com
TXTText data (verification, SPF, etc.)v=spf1 include:_spf.google.com
NSNameserver for the domainexample.com β†’ ns1.provider.com

A records are the most common β€” they point your domain to a server IP.

CNAME records are aliases β€” www.example.com points to example.com, which has the actual A record.

Common DNS tasks

Point a domain to a server:

Type: A
Name: @           (or example.com)
Value: 93.184.216.34
TTL: 3600

Point www to the same place:

Type: CNAME
Name: www
Value: example.com
TTL: 3600

Verify domain ownership (Google, Vercel, etc.):

Type: TXT
Name: @
Value: google-site-verification=abc123...

DNS propagation

When you change DNS records, the change doesn’t happen instantly. Old records are cached by DNS servers worldwide.

  • TTL (Time To Live) controls how long records are cached
  • Low TTL (300 = 5 min): changes propagate fast, more DNS lookups
  • High TTL (86400 = 24 hours): changes are slow, fewer lookups

Before making changes: lower the TTL to 300 a day in advance. After the change propagates, raise it back.

Checking propagation:

# Check from your machine
dig example.com
nslookup example.com

# Check from specific DNS server
dig @8.8.8.8 example.com
dig @1.1.1.1 example.com

Or use dnschecker.org to check from multiple locations worldwide.

Common DNS issues

β€œDNS not propagated yet” β€” wait. It can take up to 48 hours (usually much less).

β€œSite not working after domain change” β€” check with dig:

dig example.com +short
# Should show your server's IP

β€œEmail not working” β€” check MX records:

dig example.com MX +short

β€œSSL certificate error after DNS change” β€” the new server needs its own SSL certificate. If using Let’s Encrypt, it needs DNS to be pointing to it first.

DNS providers

Your domain registrar usually provides DNS, but you can use a dedicated DNS provider for better performance:

  • Cloudflare β€” free, fast, DDoS protection
  • Route 53 β€” AWS, reliable, integrates with AWS services
  • Google Cloud DNS β€” similar to Route 53
  • Your registrar β€” Namecheap, GoDaddy, etc. (fine for simple setups)

For a more detailed technical walkthrough, see how DNS actually works. DNS is closely related to secure connections β€” learn more in what is HTTPS.

FAQ

How long does DNS propagation actually take?

It depends on the TTL (Time To Live) of the old record. If the TTL was 3600 (1 hour), most resolvers will pick up the change within an hour. In practice, most changes propagate within 1-4 hours, though it can take up to 48 hours for all global resolvers.

Can DNS go down and take my site offline?

Yes. If your DNS provider has an outage, browsers can’t resolve your domain to an IP address, making your site unreachable even if your server is fine. Using a provider with high uptime (Cloudflare, Route 53) and considering secondary DNS mitigates this risk.

What’s the difference between a domain registrar and a DNS provider?

A registrar is where you buy and own your domain name (Namecheap, Google Domains). A DNS provider hosts your DNS records and answers queries. They can be the same company, but you can use a different DNS provider (like Cloudflare) while keeping your registrar separate.

Related: How DNS Resolves a Domain Name Β· DNS Resolution Failed β€” fix Β· What is a CDN?