How DNS Works: From Domain Name to Web Page
Learn how DNS works in plain English — the journey from typing a domain name to loading a web page. Understand resolvers, records, TTL, and why DNS matters for every web developer.
You type kaiko.dev in your browser and a page loads. But your browser doesn’t actually know what kaiko.dev means — it needs an IP address. How DNS works is the process of translating domain names into the IP addresses that computers use to find each other.
The Phone Book of the Internet
DNS (Domain Name System) is often called the internet’s phone book. Instead of memorising that kaiko.dev lives at 76.76.21.21, you type the name and DNS looks up the number for you.
The DNS Resolution Process
When you type a domain name:
- Browser cache — has it looked this up recently? If yes, use the cached IP.
- OS resolver — your operating system checks its own cache and the local
hostsfile. - Recursive resolver — your ISP’s DNS server does the heavy lifting.
- Root nameservers — the resolver asks which servers handle
.devdomains. - TLD nameserver — the
.devregistry says which nameserver handleskaiko.dev. - Authoritative nameserver — the final answer: here’s the IP address.
This all happens in milliseconds.
DNS Record Types
A record — Maps a domain to an IPv4 address
kaiko.dev → 76.76.21.21
AAAA record — Maps a domain to an IPv6 address
CNAME — Alias pointing to another domain
www.kaiko.dev → kaiko.dev
MX record — Mail server for the domain
kaiko.dev → mail.googlemail.com
TXT record — Verification and metadata
(Used for Google Site Verification, SPF records, etc.)
TTL — How Long Records Are Cached
Every DNS record has a TTL (Time to Live) in seconds. A TTL of 3600 means the record is cached for 1 hour. When you update DNS records (like pointing a domain to a new server), changes propagate slowly because every resolver keeps the old record until its TTL expires.
Before migrating a site: lower the TTL to 300 seconds a day in advance. The change will propagate much faster.
Conclusion
Understanding how DNS works helps you debug domain issues, understand propagation delays, and configure your own domains correctly. When your site isn’t loading after a domain change, it’s almost always a DNS propagation delay — now you know exactly why.
Read next: What Happens When You Type a URL in Your Browser?
External resource: Cloudflare — What Is DNS?
Related Articles
CSS Flexbox in Plain English: A Beginner's Guide
Learn CSS Flexbox with simple, visual explanations. This guide covers display flex, justify-content, align-items, flex-wrap, and practical layouts every developer needs to know.
Environment Variables Explained: Keeping Secrets Out of Code
Learn what environment variables are and why every developer needs them. This guide covers how to use .env files, os.environ in Python, process.env in Node.js, and best practices.
Six ES6 Features Every JavaScript Developer Should Know
Master the most important ES6 JavaScript features including arrow functions, destructuring, template literals, spread operator, modules, and default parameters with examples.