What actually happens when you type google.com in your browser and press Enter
Tags: websearch, whenyoutype, internet, whathappenwhenyoutype
Published: 2023-10-16 05:00:00

In today's world, you can literally get all what you need on the internet. All you have to do, is just "Google it", and instantly you have thousands of possible results that fits your search. Everyday, thousands of searches are done on the internet and many, not to say thousands of results are found, thanks to it's wide range of resources. Surprisingly, this happens in a fraction of a second, milliseconds to be specific.

I got curious, and asked myself, "What actually happens, when I type a or search for a something in a browser", and my findings were quite amazing, as I was fascinated about the different requests and interactions that happens in less than a fraction of a second.

Within the following few lines, I will be sharing with you my findings, and try as much as possible to be clear and break everything down for you. So sit down, tie your seat belt, and relax as we embark on a journey into the intricate world of internet technologies, where a simple web search transforms into a captivating dance of protocols, servers, and data.


![google logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5h9ufhatzljbwf9v62i.gif)



## Work flow

What really happens when we type a word on a browser and press Enter is a long, I mean it, very long sequence of events, and trying to explain it won't really fit in one blog post 😅. So we are going to focus mainly on key sectors so that we can have a clear general overview of the magic of the internet.
So I will be dividing this blog post into key points; we will talk about the following points

- DNS request

- TCP/IP

- Firewall

- HTTPS/SSL

- Load-balancer

- Web server

- Application server

- Database

For this blog post, we will focus on _"when you type google.com in a browser and press Enter"_, I believe it's literally the same for all the other searches, So let's get started 😎

**1. DNS Request: Finding the Address**

The journey begins with a DNS _(Domain Name System)_ request. Think of DNS as the internet's phonebook, translating human-friendly domain names like "google.com" into machine-friendly IP addresses. Your browser, acting as a diligent messenger, sends a DNS query to a DNS server, asking for the IP address associated with "google.com". Google IP address, For IPv4: 8.8.8.8 and/or 8.8.4.4 . For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844, which is quite difficult to remember, so the DNS is very helpful. 💪


![DNS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6s0olt8j8ib22trr7x6w.gif)



**2. TCP/IP: Establishing the Connection**

Armed with the IP address, your browser initiates a conversation with the Google server using TCP/IP _(Transmission Control Protocol/Internet Protocol)_. TCP/IP is the internet's lingua franca, governing how data packets are exchanged between computers. It ensures that your request reaches the intended destination and that the server's response finds its way back to you.

**3. Firewall: Guarding the Gates**

Before reaching the Google server, your request encounters a firewall, a vigilant gatekeeper protecting the server from unwanted intrusions. The firewall scrutinizes your request, ensuring it adheres to security protocols and poses no threat. If the firewall deems your request safe, it grants passage, allowing it to proceed towards the web server. However, if the firewall detects any suspicious activity, it promptly blocks the request, preventing it from reaching the server and potentially compromising its security.

Firewalls play a critical role in maintaining the integrity and security of servers, ensuring that only legitimate requests are granted access. They act as the first line of defense against cyberattacks, protecting sensitive data and preventing unauthorized intrusions.

**4. HTTPS/SSL: Securing the Communication**

As your request enters the realm of the Google server, it enters a secure HTTPS _(Hypertext Transfer Protocol Secure)_ connection. HTTPS, the secure version of HTTP, employs SSL _(Secure Sockets Layer)_ to encrypt the communication, safeguarding your sensitive data from prying eyes.

The encryption process involves a complex exchange of digital keys between your browser and the server. These keys act as unique locks and keys, ensuring that only the intended recipient can unlock and understand the encrypted data.

HTTPS/SSL also provides data integrity, ensuring that the data you receive from the server hasn't been tampered with during transmission. Any attempt to alter the data would result in a mismatch between the encryption keys, alerting both parties to the potential breach. 🤓

**5. Load Balancer: Distributing the Load**

Imagine a bustling city, with vehicles streaming in and out, each seeking a destination. In the realm of the internet, load balancers play the role of traffic controllers, ensuring that the constant influx of requests doesn't overwhelm the servers and cause digital gridlock.

Google, being a popular destination on the internet, receives a constant stream of requests from users worldwide. To handle this immense traffic efficiently, it employs load balancers, the unsung heroes of internet infrastructure.

Load balancers act as intermediaries between users and servers, intelligently distributing incoming requests across multiple servers. They assess the workload of each server, ensuring that no single server becomes overloaded while others remain idle.

This load distribution strategy ensures optimal performance and responsiveness for users. By spreading the load evenly, load balancers prevent bottlenecks and delays, ensuring that users receive a seamless experience, even during peak traffic periods.

It's clearly visible that Load Balancer plays a very important role

**6. Web Server: Fetching the Content**

In a world teeming with information, libraries serve as repositories of knowledge, carefully organizing and preserving literary treasures. In the digital realm, web servers play a similar role, acting as the custodians of website content, ready to serve it to eager visitors.

When your request to access Google's website reaches a web server, it's like stepping into a vast digital library. The web server, upon receiving your request, diligently retrieves the requested web page, which may include HTML, CSS, JavaScript, and images.

The web server acts as a meticulous curator, carefully assembling the various components of the web page. It retrieves the HTML code, which provides the structure and content of the page, and the CSS code, which defines the page's visual style and layout.

In addition, the web server fetches any JavaScript files, which add interactivity and dynamic behavior to the page, and any images or media files that enrich the visual experience. It carefully packages all these elements into a cohesive whole, ready to be delivered to your browser.


![Web server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcmqov7unkghy96dv6l0.gif)



**7. Application Server: Processing the Data**

In the intricate world of web applications, where dynamic content and complex interactions reign supreme, application servers stand as the masterminds behind the scenes. They act as the bridge between data and presentation, orchestrating the processing and delivery of dynamic content to web pages.

When you perform a search on Google, the web server may enlist the help of an application server to generate the personalized results you see. The application server, adept in data manipulation, retrieves relevant information from databases and processes it to create the dynamic content.

The application server acts as a skilled chef, carefully combining ingredients to create a delectable dish. It gathers data from various sources, such as user profiles, search history, and real-time information, and processes it according to complex algorithms and business logic.

The result of this data alchemy is the dynamic content that appears on your screen - personalized search results, tailored recommendations, or interactive elements that respond to your actions. The application server, working behind the scenes, brings these dynamic elements to life.

**8. Database: The Data Storehouse**

In a world awash with data, databases stand as the custodians of information, meticulously organizing and preserving the digital treasures that fuel our modern world. When you search for information on Google, databases play a crucial role in retrieving and delivering the relevant results.

Databases, the repositories of structured data, store vast amounts of information, ranging from user profiles to product catalogs to historical records. They provide a systematic way to store, organize, and retrieve data, ensuring that information is readily available when needed.

When the application server needs specific data to generate dynamic content, it queries the database, sending a request for the relevant information. The database, acting as a diligent archivist, searches its vast collection and retrieves the requested data.

Databases employ various techniques to optimize data retrieval, ensuring that requests are fulfilled efficiently. They use indexing strategies to quickly locate specific pieces of information, and they employ query optimization techniques to minimize the time it takes to extract the desired data.

The retrieved data, often in the form of tables or records, is then sent back to the application server, where it is further processed and transformed into the dynamic content that appears on your screen.

## Additional steps

**9. The Response: Delivering the Web Page**

Once the web page is assembled, the web server sends it back to your browser, carefully packaged into TCP/IP packets. These packets travel back through the internet, following the same path they took to reach the server.

**10. Your Browser: Rendering the Page**

Your browser, eagerly awaiting the response, receives the packets and reassembles them into the web page. It then diligently interprets the HTML, CSS, and JavaScript, rendering the web page in all its glory on your screen.
And we are back to the browser, all this happens with a fraction of a second. Internet and technology is indeed magical 😏


![Good of the journey](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zljeb33xx3htlv50mfyb.gif)



## Conclusion

As you navigate the internet, seamlessly accessing websites and retrieving information, remember the intricate dance of technologies that unfolds behind the scenes. From DNS requests to database queries, each step plays a crucial role in delivering the seamless online experience we often take for granted.


![Summary of interactions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6vyuxx7t49uw21oucb7.jpg)



The next time you type a URL and press Enter, appreciate the hidden symphony that brings the internet to life. It's a testament to the ingenuity of human innovation, where a simple web search represents a complex interplay of protocols, servers, and data, all working in harmony to connect us to a world of information.


![it was a very cool experience](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/idcr2oyercitgipwqkho.gif)



Hope you enjoyed the journey 😄.
Until next time, bye bye 👋.