What happens when you type google.com in your browser and press Enter?
Tags: programming, webdev, beginners, tutorial
Published: 2023-04-16 23:14:27

When you type a website URL like [google.com](https://www.google.com) in your browser and hit enter, your browser initiates a series of steps to retrieve and display Google homepage. We will take a closer look at what happens in each step.

![A DNS Meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ezcv1zmt7kb0fz8058l.png)

- **Domain Name Server (DNS) Lookup** - First, your browser contacts the DNS server, which is like an office that stores the addresses of all websites on the internet. When you enter [google.com](https://www.google.com), the DNS server responds with the IP address where google is hosted. Think of it like finding someone's house by looking up their address. Google has dozens of addresses however, these addresses can be found in their public DNS server `8.8.8.8`

- **TCP/IP Connection** - Once your browser has the IP address, it establishes a connection to the address/server using TCP/IP. **TCP (Transport Control Protocol)** is like a pathway for your browser to connect to the address/server, while **IP (Internet Protocol)** lets your browser listen on the same port. In the case of HTTPS, communication is established using TCP/IP on port `443`.

- **Firewall** - As your browser connects to the address/server, any traffic to and from the address/server is monitored and filtered by the firewall. This helps ensure that only safe and authorized traffic is allowed to pass through.

![An HTTP/HTTP Meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r6exhbdbymuqrzorxxmp.png)

- **HTTPS/SSL** - There's a difference between **HTTP** and **HTTPS**. HTTP is an unsecure protocol version, while HTTPS is the secure version that uses SSL encryption to protect your data. When you use HTTPS, your data is encrypted using SSL before being sent and decrypted by the server when it is received. **SSL (Secure Sockets Layer)** ensures that your data is protected from eavesdropping by third parties. This is important when you're entering sensitive information such as passwords, credit card numbers, or personal information. By using HTTPS, you can be confident that your information is being transmitted securely and that it cannot be intercepted or stolen by hackers.

- **Load Balancing** - When you enter [google.com](https://www.google.com), millions of people around the world could be accessing **Google** at the same time, which could overload the servers. Load balancing helps distribute the traffic to different servers to prevent overloading. One way of distributing traffic is called **round-robin**, where each server receives an equal number of requests. This ensures that your request is properly handled and the website loads quickly.

- **Web Server** - The web server is like a house that hosts static files, such as HTML, CSS, and JavaScript files. When you enter [google.com](https://www.google.com), the home page that appears on your screen is loaded from the web server (see image below).

![Google Homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlacus64n03ys0z60sc6.png)

- **Application Server** - An application server is used to serve dynamic content. For example, After accessing the Google home page above, you can enter a search request, such as "**Lionel Messi**". The application server serves content and pages about **Lionel Messi**, including his biography, statistics, photos, and videos, amongst other information. This is possible because the application server is programmed to respond to requests for dynamic content.

![A Google Meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bloulb1q8xqibuvh4mhc.png)


- **Database** - The database is where data is stored and retrieved by the application server. For example, the application server could store information about **Lionel Messi** and retrieve it when someone searches for him.

By now, you should have a clearer picture of the process that occurs behind the scenes when you enter [google.com](https://www.google.com) or a website URL in your browser, which ultimately results in being able to access the content you seek.

Side Note - **Lionel Messi** is the greatest footballer of all time.

![A picture of Lionel Messi with a goat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v58bibcw1er5ddtfdhxm.png)