DEV Community

Cover image for What happens when you type google.com in your browser??
Shobi Ola-Adisa
Shobi Ola-Adisa

Posted on • Edited on

What happens when you type google.com in your browser??

It's not often you meet someone who has never used Google Maps to get somewhere. We all need directions sometimes. Believe it or not, your browser is similar. It needs directions to all those websites you spend so much time on (I'm looking at you, Netflix.com). It's hard for humans to remember the IP address of all their favorite websites, so domain names are used instead. This article explains the routine every browser must follow to match a domain name to an IP address.


So how does it work?

You open your browser in a rush to search for the meaning of that 10-syllable word you just received by text, or maybe it's just one of your usual curious searches (Don't panic; your search history is safe). You type "google.com" in your search bar and hit enter, and your result is there. But what happened behind the scenes? How does your browser know what server to contact when you type google.com if you didn't give it the IP address? It is just as clueless as you are about where to find "google.com."

To find the IP address, the browser first checks its cache for a record of the I.P. Before commencing this routine, your browser has to be absolutely sure there is no other alternative. If a record is not found in the browser cache (records), it then makes a request to the Operating System(O.S.). The O.S., similarly, checks its cache for a record of google.com's I.P. address.

If the O.S. finds nothing (This typically happens when it is your first time visiting that webpage), then a request to something called a Recursive DNS server, which is usually managed by your Internet service provider (M.T.N., Airtel, Canalbox, AT&T). The DNS resolver first looks for the I.P. address in its records. Once the DNS finds the record, it returns it to your browser. The O.S. and the browser both immediately store it in their caches for optimization, and the webpage is loaded. Now, you can go back to your conversation without anybody knowing you looked up that word.

If the DNS Resolver can't find a record. What happens?

In some cases, the DNS Resolver will not have a record of the requested webpage, google.com in this case. When this happens, the request is passed to the root server. Every DNS resolver must, at least, be able to locate the root server.

The root server is like the glossary in a book. It doesn't contain the answers you need, but it can tell you which page to find what you're looking for. Root servers are like signposts on the internet that help your computer find its way to the right websites. It tells your computer where to go next to get the information you want.


IP resolution components

Once the request is passed to the root server, it responds to the DNS resolver with the location of a server called the top-level domain(TLD) server.

What is a TLD server?

Think of a TLD (Top-Level Domain) server as the tabs or dividers in an alphabetic dictionary that separate words starting with different letters. When you're looking for a specific word, you first find the correct section/tab based on the starting letter of that word. Similarly, a TLD server helps organize internet addresses based on their domain names (like google.com, where ".com" is the Top Level Domain), making it easier for your computer to locate the right webpage, just as those dictionary tabs help you find the right section for a word.

Top Level Domain Servers manage data for domains with the same domain extension. The TLD server we are dealing with handles domains with the domain name extension ".com," as in "google.com." When a request is made, the TLD servers respond with another address, leading to the authoritative name servers.

The Final Step?

As the name suggests, authoritative servers are the final stage in this process. They respond with definitive(authoritative) and accurate records for domain names and their associated IP addresses. Once the DNS resolver receives the IP address for the domain, it is stored to avoid going through the same routine multiple times.

The I.P. address is relayed to your device, where the O.S. also saves it before loading it on your browser.

P.S.: This happens within a fraction of a second, making it nearly impossible for the user to notice anything behind the scenes.

Here is a fun comic to learn more: link

PC: Onochie Igboerika

Top comments (0)