What happens when you type a URL into a browser and press Enter?
HardConceptScenario Questions
Answer
The browser finds the server's IP address with DNS, opens a TCP connection, secures it with TLS, sends an HTTP request and renders the response. Each step depends on the one before it.
- DNS first: packets are routed by IP address, not by name, so the name must be resolved, using caches wherever possible.
- TCP, then TLS: HTTP needs a reliable byte stream, and HTTPS adds encryption and server authentication on top. HTTP/3 replaces both with QUIC over UDP, using fewer round trips.
- Lower layers throughout: ARP finds the gateway's MAC address, NAT rewrites the private source address, routers forward packets hop by hop, and the server is often reached through a CDN or load balancer.
- Rendering: the browser parses HTML into the DOM (Document Object Model) and CSS into the CSSOM, fetches images and scripts, runs JavaScript, then lays out and paints the page.
Example: Typing https://www.example.com/ and pressing Enter:
1. Parse URL : scheme https, host www.example.com, port 443, path /
2. DNS : browser, OS, resolver caches, then root -> .com -> example.com -> 203.0.113.10
3. TCP : SYN -> SYN-ACK -> ACK with 203.0.113.10:443
4. TLS : ClientHello -> ServerHello + certificate -> keys agreed, certificate verified
5. HTTP : GET / (Host: www.example.com) -> 200 OK with HTML
6. Render : build DOM and CSSOM, fetch CSS, JS and images, paint the page