What Happens When You Type a URL and Press Enter
A clear, step-by-step walk through the full browser request lifecycle — URL parsing, DNS, TCP, TLS, the HTTP exchange, and how the page actually renders.
It is the most common interview question in web development for a reason: answering “what happens when you type a URL and press Enter” honestly forces you to touch nearly every layer of the network stack. Here is the whole journey, kept at a level where each step actually makes sense.
From keystrokes to an IP address
The browser first parses the URL. A string like https://example.com/path?q=1 is broken into a scheme (https), a host (example.com), an optional port (defaulting to 443 for HTTPS, 80 for HTTP), a path, and a query string. If what you typed is not a valid URL — say, just weather — the browser hands it to your default search engine instead.
Next comes DNS resolution, because the network routes packets to IP addresses, not names. The browser checks a series of caches before asking anyone: its own in-memory cache, then the operating system’s cache (and your hosts file). On a miss, it asks a recursive resolver — usually run by your ISP or a public service like 1.1.1.1 or 8.8.8.8. If the resolver does not have the answer cached, it walks the hierarchy: it queries a root nameserver, which points to the TLD nameserver for .com, which points to the authoritative nameserver for example.com, which finally returns the IP. Each record carries a TTL that controls how long it may be cached, so most lookups never reach the authoritative server at all.
Opening a connection: TCP and TLS
With an IP in hand, the browser opens a TCP connection using the three-way handshake: it sends a SYN, the server replies SYN-ACK, and the browser answers ACK. After that round trip, both sides have a reliable, ordered byte stream.
For https://, a TLS handshake runs on top of TCP before any HTTP data flows. The client and server agree on a protocol version and cipher suite, the server presents its certificate (which the browser validates against trusted certificate authorities and the hostname), and they derive the symmetric keys used to encrypt the session. TLS 1.3 streamlined this to roughly one round trip, with a “0-RTT” resumption mode for repeat visits. Everything after this point is encrypted.
The request, the response, and rendering
Now the browser sends the HTTP request, typically a GET for the path, along with headers like Host, User-Agent, Accept, and any cookies. The server processes it and returns a response: a status line (200 OK, 301 Moved Permanently, 404 Not Found), response headers (Content-Type, Cache-Control, Set-Cookie), and the body — usually the HTML document.
GET /path?q=1 HTTP/1.1Host: example.comAccept: text/html
HTTP/1.1 200 OKContent-Type: text/html; charset=utf-8Cache-Control: max-age=3600The browser then parses the HTML and builds the DOM (Document Object Model), a tree of nodes representing the page. As it parses, it discovers references to subresources — CSS, JavaScript, images, fonts — and fetches each one, often over the same connection. CSS is parsed into the CSSOM; the two trees combine into a render tree, the browser computes layout (the geometry of every box), and finally paints pixels to the screen. JavaScript can block parsing or modify the DOM along the way, which is why script placement and async/defer matter for how fast a page becomes usable.
Caching layers sit over this entire flow. The browser may serve the document or its assets straight from its HTTP cache based on Cache-Control and validation headers like ETag. A CDN may answer from an edge node. The server may pull from an application or database cache. The fastest request is the one that never has to travel.
FAQ
FAQ
Why does a page load faster the second time?+
What is the difference between a recursive resolver and an authoritative nameserver?+
Does HTTP/2 or HTTP/3 change this picture?+
Related reading
2026-06-04
ACID vs BASE: What Database Guarantees Actually Promise
ACID and BASE describe two ends of a tradeoff between strict correctness and scalable availability. Learn what each guarantee means, when each fits, and why most modern databases sit somewhere in between.
2026-06-04
Big-Endian vs Little-Endian
Byte order explained: how big-endian and little-endian lay out multi-byte numbers in memory, why network protocols pick one, and when the difference actually bites you.
2026-06-04
Big-O Notation in Plain English
Big-O describes how an algorithm's runtime or memory grows as input grows. Learn the common classes — O(1), O(log n), O(n), O(n log n), O(n^2), O(2^n) — with plain examples.
2026-06-04
CORS in Plain English: Why the Browser Blocks Your Fetch
A clear walkthrough of CORS and the same-origin policy — what an origin is, why your fetch fails, how servers opt in, and the big misconception about who CORS actually protects.
2026-06-04
Environment Variables and PATH, Explained
What environment variables actually are, why they hold config and secrets, and how PATH decides which binary runs when you type a command.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.