Sharing notes from my ongoing learning journey — what I build, break and understand along the way.
What Happens When You Type a URL in Your Browser?
From DNS Lookup to Rendering: The Journey of a Web Request
We do this countless times every day: type an address into a browser, hit Enter, and the page appears in seconds.
But in that short moment, a lot happens behind the scenes.
Let’s walk through it step-by-step.
1. Converting the address to a number – DNS (Layer 7 → Application, down to Layer 3 → Network)
www.example.com
is easy for us to understand, but the internet works with IP addresses.
So first, we need to answer the question: “What number (IP) corresponds to this name?”
This is the job of DNS (Domain Name System).
The browser first checks its own memory (cache). If not found, it asks the operating system, then the router/modem.
If it’s still not found, it queries a DNS server (your ISP’s, Google DNS, Cloudflare, etc.).
If needed, that DNS server will go up the chain: root servers → TLD (.com) servers → the site’s authoritative DNS server.
Finally, we have an IP address, like 93.184.216.34
.
2. Knocking on the door – Establishing a connection (Layer 4 → Transport)
With the IP address ready, it’s time to reach the server.
Most often, this is done via TCP and starts with a handshake:
- I’m here (SYN)
- Got it, I hear you (SYN-ACK)
- Let’s talk (ACK)
The newer QUIC protocol can do this faster and has extra benefits.
3. Opening a secure tunnel – TLS (Layer 6 → Presentation)
If the address starts with https
, the communication will be encrypted.
The server shows its ID card (SSL/TLS certificate).
The browser checks this certificate against its list of trusted authorities.
Then, the two agree on an encryption key.
From now on, even if someone intercepts the traffic, they can’t read it.
4. Sending the request – HTTP (Layer 7 → Application)
Through the encrypted tunnel, the browser says: “Please send me this page.”
The request contains:
- Which browser is being used
- Language preferences
- Necessary cookies
- Request type (GET, POST, etc.)
5. Stops along the way – CDN and security layers (Mostly Layer 7, sometimes Layer 4 filtering)
The request doesn’t always go directly to the server.
If there’s a CDN (Content Delivery Network), it sends you to the nearest copy of the content.
Security layers like WAF (Web Application Firewall) may check: “Is this request malicious?”
6. Server-side processing (Layer 7)
The server receives the request and does the necessary work:
- Queries the database
- Talks to other services if needed
- Prepares HTML, CSS, images, data packages
Then it packs the response.
7. Sending the response back (Layer 7 → down to Layer 1)
The server sends the response back to the browser.
Along with the response, it might include:
- Cache-Control: How long it can be stored locally
- Security headers: e.g., must only be opened via HTTPS
- Additional resources: images, fonts, script files
8. The browser’s turn – Rendering (Layer 7)
The browser reads the HTML and builds a DOM tree.
CSS is applied for styling, JavaScript adds interactivity.
Everything is converted into pixels and drawn on the screen.
In the background, it may fetch additional files (images, videos, API data).
9. The OSI layers in this process
Here’s where each stage fits into the OSI model:
Layer 7 – Application → HTTP, HTTPS
Layer 6 – Presentation → TLS encryption
Layer 5 – Session → (Implied in connection handling)
Layer 4 – Transport → TCP / QUIC
Layer 3 – Network → IP
Layer 2 – Data Link → Ethernet / Wi-Fi
Layer 1 – Physical → Cable, fiber, radio signal
In Short
Address → IP lookup (DNS) → Connection (TCP/QUIC) → Encryption (TLS) → Request (HTTP) → Response → Rendering on screen
Along the way, there are extra steps for performance, security, and caching.