DNS Explained: How Your Browser Decodes Website Addresses

Jino R Krishnan
4 min readApr 5, 2023
Photo by mohammed saif on Unsplash

Have you ever wondered how your browser knows where to find a website when you type its address? Well, it’s not magic, it’s DNS! DNS stands for Domain Name System, and it’s like a phone book for the internet. DNS helps your browser translate a human-readable address, like www.bing.com, into a machine-readable address, like 204.79.197.200. This way, your browser can connect to the right server and load the website you want.

But how does DNS work exactly? Let’s take a closer look at the process.

Step 1: You type a website address in your browser.

When you enter a website address in your browser, like www.bing.com, you are actually typing a domain name. A domain name is a unique name that identifies a website on the internet. Domain names are composed of different parts, separated by dots. The rightmost part is called the top-level domain (TLD), and it indicates the category or the country of the website. For example, .com is a TLD for commercial websites, .edu is a TLD for educational institutions, and .uk is a TLD for websites from the United Kingdom.

The part to the left of the TLD is called the second-level domain (SLD), and it is usually the name of the organization or the brand that owns the website. For example, bing is the SLD for www.bing.com, and microsoft is the SLD for www.microsoft.com.

The parts to the left of the SLD are called subdomains, and they are optional. They can be used to create different sections or categories within a website. For example, news.bing.com is a subdomain of www.bing.com that shows news articles.

Step 2: Your browser asks your operating system for the IP address of the website.

Your browser doesn’t know how to find the IP address of the website you want to visit by itself. It needs to ask your operating system (OS) for help. Your OS is the software that runs your computer and manages its resources. Your OS has a special file called hosts that stores some mappings between domain names and IP addresses. Your browser checks this file first to see if it has an entry for the website you want to visit. If it does, your browser uses that IP address and skips the rest of the steps.

However, most of the time, your hosts file doesn’t have an entry for the website you want to visit. In that case, your browser asks your OS to contact a DNS server. A DNS server is a computer on the internet that knows how to translate domain names into IP addresses. Your OS usually uses the DNS server provided by your internet service provider (ISP), but you can also configure it to use a different one.

This website has the list of servers that maintain the TLD database at various locations.

Root Servers (iana.org)

Step 3: Your OS contacts a DNS server and asks for the IP address of the website.

Your OS sends a query to the DNS server with the domain name you want to resolve. The DNS server then tries to find the IP address of that domain name in its own records. If it has it, it sends it back to your OS and your browser can use it to connect to the website.

However, most of the time, the DNS server doesn’t have an entry for the domain name you want to resolve. In that case, it has to ask other DNS servers for help. This is where things get interesting.

Step 4: The DNS server contacts other DNS servers until it finds the IP address of the website.

The DNS server doesn’t know where to find all the IP addresses in the world, but it knows where to find other DNS servers that might know. There are different types of DNS servers in a hierarchical structure:

- Root servers: These are 13 servers at the top of the hierarchy that know where to find all the TLD servers.
- TLD servers: These are servers that know where to find all the SLD servers for a specific TLD.
- SLD servers: These are servers that know where to find all the subdomain servers for a specific SLD.
- Subdomain servers: These are servers that know where to find all the IP addresses for a specific subdomain.

The DNS server starts by contacting one of the root servers and asking for the TLD server that handles .com domains. The root server responds with an IP address of one of those TLD servers.

And here is the list of servers that maintains the database of .com TLD domains.

.com Domain Delegation Data (iana.org)

The DNS server then contacts that TLD server and asks for
the SLD server that handles bing.com domains. The TLD server responds with an IP address of one of those SLD servers.

The DNS server then contacts that SLD server and asks for
the subdomain server that handles www.bing.com domains. The SLD server responds with an IP address

--

--