DNS: From Domain Name to IP Address
When you open a website, you usually type something like:
1https://example.comBut computers don't really use example.com to find the server.
They use IP addresses, such as:
193.184.216.34So how does your computer turn a domain name into an IP address?
The answer is DNS — Domain Name System.
You can think of DNS as the phonebook of the internet. You know a person's name, but you need their phone number to call them. Similarly, you know a website's domain name, but your computer needs its IP address to connect to the server.
Let's follow what happens when you type a website address into your browser.
What Happens When You Type a Domain Name?
Imagine you open your browser and type:
1https://example.comYour browser needs to find the IP address of example.com.
The journey looks roughly like this:
1You type example.com2 │3 ▼4 Browser checks5 its cache6 │7 ▼8 Operating system9 DNS cache10 │11 ▼12 DNS Resolver13 │14 ▼15 Root Server16 │17 ▼18 .com Server19 │20 ▼21Authoritative DNS Server22 │23 ▼24 IP Address25 │26 ▼27 Browser connects28 to the serverIt looks complicated, but each step has a simple job.
First, What Is a Domain Name?
A domain name is a human-friendly name for a website.
For example:
1google.com2github.com3example.comComputers ultimately communicate using IP addresses:
1142.250.x.x220.205.x.x393.184.x.xRemembering IP addresses for every website would be difficult.
Imagine having to remember:
1142.250.72.14220.205.73.83104.18.32.47instead of:
1google.com2github.com3example.comDNS solves this problem by connecting names to IP addresses.
Step 1: Your Browser Checks Its Cache
You type:
1example.comThe browser first checks whether it already knows the IP address.
If you recently visited the same website, the browser may already have the answer stored in its cache.
For example:
1example.com2 ↓393.184.216.34If the cached information is still valid, the browser doesn't need to ask a DNS server again.
This makes the process much faster.
If the browser doesn't have the answer, the request continues.
Step 2: Your Computer Checks Its DNS Cache
The operating system can also maintain its own DNS cache.
For example:
1DNS Cache2 3example.com → 93.184.216.34If the operating system already knows the answer, it can return it immediately.
But if the information isn't available, your computer sends the DNS request to a DNS resolver.
Step 3: The DNS Resolver
The DNS resolver is usually the DNS server configured on your device or network.
It might be provided by:
- Your ISP
- Your router
- A public DNS service
- Your organization's network
For example:
1Your Computer2 │3 │ "What is the IP of example.com?"4 ▼5 DNS ResolverThe resolver's job is to find the answer.
Importantly, the resolver may already have the answer in its own cache.
If it does:
1Resolver Cache2 3example.com → 93.184.216.34it can immediately return the IP address to your computer.
If not, the resolver has to find the answer.
This is where the DNS hierarchy comes in.
Step 4: The Root DNS Server
The resolver starts by asking a root DNS server.
There isn't one single root server. DNS uses a distributed system of root servers around the world.
The resolver asks something like:
"I need to find
example.com. Where should I look?"
The root server doesn't normally provide the IP address of example.com.
Instead, it points the resolver toward the server responsible for the .com domain.
1Resolver2 │3 │ Where is example.com?4 ▼5Root DNS6 │7 │ Ask the .com servers8 ▼9.com DNSThink of the root server as saying:
"I don't know the exact address, but I know who handles
.comdomains."
Step 5: The TLD Server
Now the resolver asks a TLD (Top-Level Domain) server.
For:
1example.comthe TLD is:
1.comThere are different TLDs such as:
1.com2.org3.net4.in5.devThe .com DNS servers know which authoritative DNS servers are responsible for individual .com domains.
So the resolver asks:
"Who is responsible for
example.com?"
The .com server responds with information pointing to the authoritative DNS servers for example.com.
Step 6: The Authoritative DNS Server
Now we reach the server that actually knows the DNS records for the domain.
This is called the authoritative DNS server.
For example:
1example.com2 │3 ▼4Authoritative DNS5 │6 ▼793.184.216.34The resolver asks:
"What is the IP address for example.com?"
The authoritative server provides the appropriate DNS record.
For an IPv4 address, this is usually an A record.
For IPv6, it is an AAAA record.
For example:
1example.com → 93.184.216.34The resolver now has the answer.
Step 7: The Answer Travels Back
The result travels back through the resolver to your computer.
1Authoritative DNS2 │3 │ 93.184.216.344 ▼5 DNS Resolver6 │7 │ 93.184.216.348 ▼9 Your ComputerYour browser now knows where the website's server is.
The DNS part is finished.
But the website hasn't actually been loaded yet.
Now the browser can connect to the server.
Step 8: Your Browser Connects to the Server
Your browser now knows:
1example.com2 ↓393.184.216.34It can use that IP address to establish a connection to the server.
For HTTPS websites, there are additional steps involving TCP and TLS before the browser sends the HTTP request.
Eventually, the browser sends something like:
1GET /2Host: example.comThe web server processes the request and sends a response.
The browser then receives HTML, CSS, JavaScript, images, and other resources needed to display the page.
So the complete journey looks like:
1You2 │3 │ example.com4 ▼5Browser6 │7 ▼8DNS Resolver9 │10 ▼11Root DNS12 │13 ▼14.com DNS15 │16 ▼17Authoritative DNS18 │19 │ IP address20 ▼21DNS Resolver22 │23 ▼24Browser25 │26 │ Connect to IP27 ▼28Web Server29 │30 │ HTTP response31 ▼32Browser33 │34 ▼35Web PageWhy Doesn't DNS Do This Every Time?
If your computer had to contact the root server, TLD server, and authoritative server every time you opened a website, browsing would be much slower.
This is why DNS caching is extremely important.
The answer can be cached at multiple levels:
1Browser2 ↓3Operating System4 ↓5Router6 ↓7DNS Resolver8 ↓9Authoritative DNSSuppose the resolver recently looked up:
1example.com → 93.184.216.34It can temporarily remember that answer.
The next user asking for the same domain may get the answer immediately.
What Is TTL?
DNS records have a value called TTL — Time To Live.
TTL tells caches how long they can keep a DNS answer.
For example:
1example.com2IP: 93.184.216.343TTL: 300 secondsThis means a cache can normally use that answer for about 5 minutes before it needs to obtain a fresh answer.
A longer TTL means fewer DNS lookups, while a shorter TTL allows changes to propagate more quickly.
DNS Doesn't Only Store IP Addresses
DNS can store many different types of information.
Some common DNS records are:
A Record
Maps a domain to an IPv4 address.
1example.com → 93.184.216.34AAAA Record
Maps a domain to an IPv6 address.
1example.com → 2001:db8::1CNAME Record
Creates an alias for another domain.
1www.example.com → example.comMX Record
Specifies which mail servers handle email for a domain.
1example.com → mail.example.comTXT Record
Stores text information used for various purposes, including domain verification and email security mechanisms.
So DNS is much more than simply a database of domain names and IP addresses.
What Happens If DNS Doesn't Work?
Imagine you have a perfectly working internet connection.
Your web server is also working.
But DNS is broken.
You type:
1example.comYour computer can't find the IP address.
So it doesn't know where to connect.
You might see errors such as:
1DNS_PROBE_FINISHED_NXDOMAINor:
1Server DNS address could not be foundThis is why DNS is such an important part of the internet.
The server might be perfectly healthy, but if its domain cannot be resolved, users may still be unable to reach it using the domain name.
One Simple Way to Remember DNS
Think about finding a person in a huge city.
You know:
1Person: AliceBut you don't know where Alice lives.
You first ask an information desk:
"Where should I look?"
It points you to the correct neighborhood.
Then the neighborhood directory points you to the exact building.
Finally, the building directory gives you the exact apartment.
DNS works in a similar hierarchical way:
1Domain2 │3 ▼4Root5 │6 ▼7TLD (.com)8 │9 ▼10Authoritative DNS11 │12 ▼13IP AddressEach level helps narrow down where the answer can be found.
Conclusion
DNS is one of those technologies that most people use every day without noticing.
You type a name, but computers need an IP address.
DNS acts as the bridge between the two.
It uses a hierarchy of DNS servers, caching, and different types of records to translate human-friendly domain names into information computers can use.
So the next time you type:
1google.comremember what is happening behind the scenes:
Domain name → DNS lookup → IP address → Server connection → Web page
That simple lookup is one of the fundamental building blocks that makes the internet easy for humans to use.