What Happens When You Load a URL

The full journey from pressing Enter to seeing a page — DNS, TCP, TLS and HTTP — tied together so every layer finally makes sense.

· 2 min read · beginner

"What happens when you type a URL and press Enter?" is a classic interview question because it touches every layer of the stack. Here's the whole journey.

1. Parse the URL

https://example.com/page breaks into a scheme (https), a host (example.com) and a path (/page). The scheme tells the browser which protocol and default port (443 for HTTPS).

2. DNS: name → address

Computers route by IP, not names. The browser asks a resolver to turn example.com into an IP address. If it's cached (browser, OS, or resolver), the answer is instant; otherwise the resolver walks the DNS hierarchy to find it. (See the DNS article for the full walk.)

3. TCP: open a reliable connection

With an IP in hand, the browser opens a TCP connection to port 443 via the three-way handshake (SYN, SYN-ACK, ACK). This gives an ordered, reliable byte stream.

text
Browser ── SYN ─────▶ Server
Browser ◀─ SYN-ACK ── Server
Browser ── ACK ─────▶ Server   (connected)

4. TLS: make it private

Over that connection, TLS negotiates encryption. The server presents a certificate; the browser checks it was issued by a trusted authority and matches the hostname. Both sides agree on session keys. From here, everything is encrypted — no one on the path can read it.

5. HTTP: ask for the page

Now the browser sends an HTTP request:

http
GET /page HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 ...
Accept: text/html

The server replies with a status code and the content:

http
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: max-age=3600

<!doctype html> ...

Status codes tell the story: 2xx success, 3xx redirect, 4xx your mistake (404 not found, 403 forbidden), 5xx the server's mistake.

6. Render — and do it all again

The browser parses the HTML and discovers it needs more: CSS, JavaScript, images, fonts. Each of those kicks off the same cycle (often reusing the open connection). As resources arrive, the browser builds the page and paints it.

The whole thing at a glance

text
URL ─▶ DNS (name→IP) ─▶ TCP handshake ─▶ TLS handshake ─▶ HTTP request/response ─▶ render ─▶ (repeat for each asset)

Open your browser's Network tab and reload a page — you'll see every one of these requests, their timing, and exactly where the slow parts are.

Takeaways

  • A URL load is DNS → TCP → TLS → HTTP, then rendering — and repeats per resource.
  • DNS turns the name into an IP; TCP makes the link reliable; TLS makes it private and authenticated.
  • HTTP status codes classify the outcome: 2xx/3xx/4xx/5xx.
  • The Network tab shows the whole sequence live — it's the first place to debug a slow page.

Related

Networking beginner

DNS, From Query to Answer

How a name becomes an address — resolvers, the root/TLD/authoritative hierarchy, the record types that matter, and why DNS changes take time.

· 2 min read
Networking beginner

Subnetting Without a Calculator

CIDR notation demystified. Learn the handful of powers of two that let you split and size networks in your head, with a reference table you'll actually remember.

· 1 min read