DEV Community

escaper
escaper

Posted on

What Happens When You Type ‘google.com’ and Hit Enter

Many people wonder about how the internet works, and it's a common question in interviews. I'll try to explain it in a simple way.

In today's world, we use the internet for various things like watching videos, reading news, and learning. Google seems to have answers to everything, and we can find them by typing google.com in our browser. But have you ever wondered how this process works?

When you type a website's address (URL) in your browser, your computer goes on a journey. It communicates with servers, which are like special computers that manage resources or services in a network. These servers have unique addresses called IP addresses.

So, what's an IP address? It's like a house address for computers on the internet. Each device has one, and it looks like 'xxx.xxx.xxx.xxx,' where each 'xxx' is a number from 0 to 255.

Now, how does your computer find the IP address of the website you want to visit? It goes through a process called DNS lookup.

DNS, or Domain Name System, is like a translator. It converts easy-to-remember text-based domain names (like google.com) into numerical-based IP addresses. You can think of DNS as your phone's contacts app. When you call a friend, you don't need to know their phone number by heart; you just need their name saved in your contacts. Similarly, DNS helps you visit websites without memorizing their IP addresses.

After typing a URL, your browser checks its own memory (cache) for the IP address. If it's not there, it looks in the computer's memory, the router's memory, and even the Internet Service Provider's (ISP) memory. This whole process is the DNS lookup.

If the IP is found, great! Your browser goes to the website. If not, it keeps searching until it either finds the IP or concludes that it doesn't exist.

There's much more to DNS, like sub-processes and hierarchy, but for now, this basic explanation should give you an idea of how your browser finds and connects to websites.

So, once your browser has the IP address, what happens next? That's a story for another time!

Top comments (0)