Field Guide · Vol. 1
URL → Pixels

How a Browser Actually Works.

A browser's only job is to turn a string of text — a URL — into a moving rectangle of pixels you can see, click, and trust. Everything below is the machinery that makes that possible.

01 · The Journey Begins

From URL to bytes on the wire

Before a single pixel paints, the browser plays diplomat — translating a human-readable address into an IP, opening a secure pipe, and negotiating a conversation.

1
DNS
postman.com → 18.65.0.42 via recursive resolvers & OS cache
2
TCP
3-way handshake (SYN, SYN-ACK, ACK) opens reliable stream
3
TLS
Cert exchange, key agreement, encrypted tunnel established
4
HTTP
GET / HTTP/2 — request headers, cookies, multiplexed streams
5
Bytes
Server streams gzipped HTML back in chunks
You SERVER REQUEST ⟶ ⟵ RESPONSE

Fig. 1 — The browser as diplomat: round-trips before a single character of HTML arrives. With HTTP/3 (QUIC), the TCP and TLS handshakes fuse into one trip.

02 · Construction

Two trees grow in parallel

As HTML bytes stream in, the parser tokenizes them into nodes — building the DOM. The moment a stylesheet is discovered, a second parser starts on the CSS, producing a CSSOM. They are siblings, racing.

DOM TREE · from HTML
html html head body title h1 div structure & content
CSSOM TREE · from CSS
body body font color 16px #0a1020 1.6 styles & cascade
⚠ Render-blocking interrupt: when the HTML parser hits a <script> (without async or defer), parsing PAUSES. The script must be fetched, parsed, and executed before tree construction resumes. This is why script placement is a performance lever.

Fig. 2 — DOM and CSSOM grow side by side. They will be married in the next stage to form the render tree.

03 · The Critical Rendering Path

How trees become pixels

The DOM and CSSOM merge into a render tree. The browser computes geometry (layout), fills in pixels (paint), and the GPU stitches layers into a final frame (composite). Every UI update re-runs some portion of this path.

DOM
CSSOM
RENDER TREE
LAYOUT
PAINT
COMPOSITE
Expensive (CPU, main thread) Moderate (CPU) Cheap (GPU)
LAYOUT · WHERE 80×50 100×50 200×50 geometry only PAINT · WHAT A B C COMPOSITE GPU stitches

Which CSS properties trigger what?

Property changedTriggersCost
width, height, top, left, padding, font-size Layout → Paint → Composite expensive
color, background, box-shadow, border-radius Paint → Composite moderate
transform, opacity, filter Composite only (GPU) cheap

Fig. 3 — Why transform: translateX(100px) beats left: 100px for animation: it skips two of the three most expensive stages.

04 · The Engine Room

JavaScript & the event loop

JavaScript runs on a single thread. The illusion of concurrency is choreography: synchronous code on a call stack, asynchronous work delegated to Web APIs, and a loop that pulls completed work back in — microtasks first, then one macrotask, then repeat.

See the full deep-dive in Event Loop & Async.

05 · The Architecture

Why Chrome runs a process per tab

Modern browsers split work across OS processes for security, stability, and parallelism. A crashed renderer doesn't take down the browser; a compromised tab can't read another tab's memory.

Browser

One per browser. Handles UI chrome (address bar, tabs), networking, disk, and orchestrates everything else.

Renderer

One per site (roughly). Runs the parsing, JS engine, layout, paint. This is where your code lives.

GPU

Single process that handles compositing layers and accelerated graphics. Talks to the actual GPU hardware.

Network / Utility

Networking isolated from renderers. Extensions, audio, video decoding spawn their own utility processes.

Fig. 4 — Chrome's process model. Site Isolation (post-Spectre) goes further: even cross-origin iframes get their own renderer process.

The one-sentence summary you can repeat in an interview

"URL → DNS & TLS & HTTP → HTML streams in → parser builds DOM, CSS builds CSSOM in parallel → they merge into a render tree → layout computes geometry, paint fills pixels, composite stitches GPU layers — and JavaScript runs on the same main thread, coordinated by the event loop, which is why blocking JS blocks everything."

Three perf rules that fall out of this

  1. Animate transform and opacity. They skip layout and paint — the GPU does all the work.
  2. Don't block the main thread. JS, layout, paint, and event handling share one thread. A 200ms function = a 200ms frozen UI.
  3. Defer non-critical scripts. Render-blocking JS pauses HTML parsing, which delays first paint. Use defer, async, or move scripts to the bottom.
How a browser works · Frontend Field Guides

Before you leave — how confident are you with this?

Your honest rating shapes when you'll see this again. No grades, no shame.

Comments

to join the discussion.

Loading comments…

Keep reading