Networking / What happens when you type a URL

What happens when you type a URL

From pressing Enter to pixels: the six stages a browser goes through, what each one hands to the next, where caches let it skip ahead, and which parts are pure waiting.

Beginner7 steps~7 min
Browser — starts every exchange
DNS resolver — turns names into addresses
Server — holds the page, at 192.0.2.10
// THE SHORT VERSION

In 30 seconds

A URL names a page, but the browser has to do four things before it can ask for it: find the server’s address (DNS), open a connection (TCP), encrypt it (TLS) and only then send the HTTP request.

The server replies with HTML, which usually points to more files. The browser fetches those too, then lays out and paints the page.

Most of the delay is round trips across the network. Caches and kept-open connections skip whole stages, so repeat visits are quicker.

What happens when you type a URL, step by step

STEPS01 / 07

The times in the last step are an illustration, not measurements. TLS 1.2 needs two round trips, and HTTP/3 merges the TCP and TLS steps into one handshake over UDP.

STEP 01 / 07 You press Enter
THE MATH
https://example.com /index.html scheme, host, path
  1. Step 1: You press Enter. The browser splits the URL into three parts. The scheme says how to talk (HTTP inside an encrypted TLS connection, on port 443). The host says which machine. The path says what to ask it for. Nothing can be fetched yet, because a name is not an address.
  2. Step 2: DNS: name to address. Packets are addressed with numbers, so the browser first asks a DNS resolver for the IP address behind example.com. The answer here is 192.0.2.10. This costs a round trip to the resolver, and more if the resolver has to go looking.
  3. Step 3: TCP: open a connection. Now the browser knows where the server is. It opens a TCP connection to port 443 with the three-message handshake. This gives both sides a reliable, ordered channel, at the price of one more round trip in which no content moves.
  4. Step 4: TLS: make it private. Because the scheme is https, the two sides run a TLS handshake over the new connection. The server proves who it is with a certificate, and both derive shared keys that no one listening can work out. With TLS 1.3 this takes one round trip. Everything after it is encrypted.
  5. Step 5: HTTP: ask, then receive. Only now does the browser send what you asked for: an HTTP request for /index.html, inside the encrypted tunnel. The server finds or builds the page and replies with a status (200 means OK), some headers and the HTML. Three round trips were spent before this one.
  6. Step 6: Render: HTML to pixels. The HTML is only a description. The browser parses it into a tree, discovers that it needs a stylesheet, a script and an image, and requests those over the same connection. When enough has arrived it works out where everything goes and paints the page.
  7. Step 7: Where the time goes. Take a round trip of 40 ms. DNS, TCP and TLS each cost one, so 120 ms pass before the request leaves. Add 100 ms for the request and the server’s work, then 150 ms to fetch the other files and paint: 370 ms. Caches and reused connections remove whole stages, which is why a second visit feels faster.
VALUES SO FAR
hostexample.comURL
path/index.htmlURL
address····DNS
port····TCP
keys····TLS
status····HTTP
extras····render
set-up····example
total····example

Spotted a mistake on this page?