awesome-everything RU
↑ Back to the climb

Browser & Frontend Runtime

The render pipeline: six stages from bytes to pixels

Crux What the six pipeline stages are, who owns the kitchen, and why the 16.67 ms frame budget decides everything.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at junior altitude — the surface
◷ 10 min

You hit Enter on a URL. Bytes start arriving. Somewhere between the first packet and the moment a button is clickable on screen, the browser ran a six-stage pipeline — and most pages spend the wrong amount of time in the wrong stage. The frame budget is 16.67 ms at 60 fps.

The six stages

The browser turns HTML + CSS + JS into pixels in exactly six steps, always in this order:

StageWhat it does
Parse HTMLWalks the byte stream and builds the DOM tree
Build CSSOMReads stylesheets and builds the CSS Object Model
StyleMatches CSS rules to DOM nodes, resolves the cascade
LayoutMeasures every box — positions and sizes
PaintFills pixels into bitmap layers
CompositeAssembles layers on the GPU and sends the frame to the screen

Two threads do the work. The main thread owns Parse HTML, CSSOM construction, style recalc, layout, and paint setup. The compositor thread assembles GPU-friendly layers and ships them to the GPU.

StageThreadDevTools label
Parse HTMLMainParse HTML
Build CSSOMMainParse Stylesheet
StyleMainRecalculate Style
LayoutMainLayout
PaintMainPaint
CompositeCompositorComposite Layers

The kitchen metaphor

The browser is a restaurant kitchen. Parsing HTML is reading the order ticket. CSSOM is reading the recipe book. Style is matching ingredients to dishes. Layout is measuring the plate and arranging food on it. Paint is the actual cooking — heat and colour. Composite is the runner who picks up six plates at once and walks them to the table.

If any station is slow, the whole table waits.

The 16.67 ms frame budget

You hit 60 frames per second only if the whole kitchen finishes in 16.67 ms. Drop a frame and the user sees a stutter — a scrolling list judders, a button feels sticky, a chart lags behind the mouse.

The fix is almost never “make JS faster” — it’s “stop the kitchen from re-doing layout when it could have just rearranged plates.”

Why this works

120 Hz monitors (iPhone Pro, Pixel flagship) halve the budget to 8.33 ms per frame. Variable-refresh-rate panels (Android “LTPO”) run between 1 Hz and 120 Hz, so the budget changes dynamically. If you target 60 fps you are already on the safe side for 90 Hz panels, but 120 Hz panels demand tighter budgets.

Read-aloud frame. Bea · Browser opens a profile card. Sven · Origin server narrates the kitchen: “0.5 ms parse the avatar div, 0.4 ms build the styles, 0.2 ms match selectors, 3 ms measure boxes — wait, the image hadn’t loaded so we re-measured, that’s another 2 ms — 1.5 ms paint, 0.5 ms composite. Frame is 8.1 ms. Fine. Now what if the user scrolls and we re-trigger layout fifty times per second? That’s 100 ms per second on layout alone, six dropped frames, the scroll feels heavy.”

Order the steps

The browser runs these six stages in a fixed order. Drag them into the correct sequence.

  1. 1 Parse HTML → DOM tree
  2. 2 Build CSSOM from stylesheets
  3. 3 Style: match selectors, resolve cascade
  4. 4 Layout: measure box positions and sizes
  5. 5 Paint: fill pixels into bitmap layers
  6. 6 Composite: assemble layers on the GPU
Quiz

Which thread does most of the work in the render pipeline?

Quiz

A page hits 60 fps. What is the per-frame budget?

Complete the analogy

The browser-as-kitchen metaphor: parsing HTML is reading the order ticket; building CSSOM is reading the recipe book; style is matching ingredients to dishes; layout is measuring the plate; paint is the cooking. What is the runner who picks up six plates at once and walks them to the table?

Compute it

A page must hit 60 frames per second. How many milliseconds does the browser have per frame?

ms
Frame budget at 60 fps
Total frame
16.67 ms
Browser overhead (rAF, input, GC)
~6 ms
JS + layout + paint budget
~10 ms
Composite-only path
~0.5 ms / frame
Recall before you leave
  1. 01
    Name the six render pipeline stages in order.
  2. 02
    Which thread owns stages 1–5? Which owns stage 6?
  3. 03
    Why is 16.67 ms the per-frame budget at 60 fps?
Recap

The browser renders a page through six fixed stages: Parse HTML, Build CSSOM, Style, Layout, Paint, and Composite. The main thread owns the first five; the compositor thread runs the sixth. At 60 fps the total frame budget is 16.67 ms; after browser overhead, application code gets roughly 10 ms. The kitchen metaphor captures why composite is cheap — the runner moves finished plates without re-cooking anything. Lessons 2–4 in this unit unpack what each stage actually costs and how to cut those costs.

Connected lessons
appears again in143
Continue the climb ↑Stage costs and the renderer process model
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.