What Happens When You Type a URL in the Browser?
I am a Computer Science graduate learning backend development with Node.js. I enjoy writing beginner-friendly articles and sharing what I learn along my journey. Currently focused on JavaScript, Node.js, and building real-world projects.
Have you ever wondered what actually happens behind the scenes when you type a URL like www.google.com into your browser and press Enter? Although it feels instant, a lot of complex processes occur in just a few milliseconds.
This blog explains the step-by-step journey of a URL from your browser to the server and back, in a simple and interview-friendly manner.
1. URL Parsing
When you type a URL, the browser first parses it to understand its components:
Protocol: https
Domain name: www.google.com
Path: /search (optional)
Example:
https://www.example.com/page
2. Browser Cache Check
The browser checks its cache to see if it already has a recent response for the requested URL.
If found and valid → load from cache
If not found → continue the process
Caching improves speed and reduces network usage.
3. DNS Lookup
The browser needs the IP address of the domain to communicate with the server.
DNS (Domain Name System) translates the domain name into an IP address.
The lookup happens in this order:
Browser DNS cache
Operating system cache
Router cache
ISP DNS server
Authoritative DNS server
Example:
www.google.com → 142.250.190.14
4. TCP Connection Establishment
After getting the IP address, the browser establishes a TCP connection with the server using the three-way handshake:
SYN
SYN-ACK
ACK
This ensures reliable data transfer.
5. TLS/SSL Handshake (HTTPS)
If the URL uses HTTPS, a secure connection is established:
Server sends SSL certificate
Browser verifies the certificate
Encryption keys are exchanged
This step ensures:
Data confidentiality
Data integrity
Authentication
6. HTTP Request Sent
The browser sends an HTTP request to the server.
Example:
GET / HTTP/1.1
Host: www.example.com
The request includes:
HTTP method (GET, POST)
Headers
Cookies (if any)
7. Server Processing
The server receives the request and:
Routes it to the correct backend service
Executes business logic
Interacts with the database if required
The server then prepares an HTTP response.
8. HTTP Response Returned
The server sends back a response containing:
Status code (200, 404, 500)
Headers
Response body (HTML, JSON, CSS, JS)
Example:
HTTP/1.1 200 OK
9. Browser Rendering
The browser now renders the webpage:
Parses HTML → DOM
Parses CSS → CSSOM
Executes JavaScript
Builds render tree
Paints pixels on screen
This is how you see the final webpage.
10. Connection Termination or Reuse
After loading the page:
The TCP connection may be closed
Or kept alive for future requests (Keep-Alive)
Why This Question Is Important for Interviews
This is one of the most frequently asked backend and system design interview questions. Interviewers check:
Networking fundamentals
Understanding of web architecture
Ability to explain complex flows clearly
Summary Flow
URL → Cache → DNS → TCP → TLS → HTTP Request → Server → HTTP Response → Rendering
Conclusion
Typing a URL into a browser triggers a fascinating chain of events involving DNS, networking, security, backend processing, and rendering. Understanding this flow is essential for backend developers and is a must-know topic for technical interviews.
Happy Learning