# Critical Rendering Path

The critical rendering path is the browser work that turns a document's initial HTML, CSS, and JavaScript into visible pixels.

- Type: framework
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-09-23
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/critical-rendering-path/>)

## What it means

The critical rendering path describes the dependencies and stages before a browser can render a page: fetching and parsing HTML, constructing the DOM and CSSOM, computing styles, laying out boxes, painting, and compositing. Scripts and styles can block or repeat parts of this work. It is a reasoning model rather than one fixed pipeline shared identically by every browser.

## Why it matters

Users cannot benefit from resources that have arrived but have not become visible. Understanding the path helps teams find render-blocking requests, excessive style or layout work, and main-thread tasks behind slow first display or visual instability.

## When to use it

Use the model when diagnosing initial rendering, late styles, large DOMs, layout thrashing, or animation jank. Start from measured traces and user-facing metrics; do not apply generic asset rules without locating the actual bottleneck.

## How it works

1. The browser receives and incrementally parses HTML into the DOM while discovering resources.
2. CSS is fetched and parsed into the CSSOM, while scripts run according to their loading behavior.
3. DOM and style information produce computed styles and a render tree for visible content.
4. Layout calculates geometry, then paint records visual output and compositing assembles layers.
5. Later mutations or viewport changes can repeat style, layout, paint, or compositing work.

## A practical example

A landing page trace shows a large stylesheet delaying the first render and a script repeatedly reading and changing layout. The team removes unused critical CSS and batches DOM work, improving visible load and interaction stability.

## Where it breaks

Modern browsers stream, speculate, parallelize, cache, and optimize these stages, so a simple diagram does not predict exact timing. Faster first paint does not guarantee useful content, responsiveness, stability, or accessibility.

## Common mistakes

- Treating network transfer as the whole rendering path.
- Inlining all CSS or script without considering cache and document growth.
- Forcing repeated synchronous layout by alternating DOM reads and writes.
- Optimizing a theoretical pipeline without checking a browser trace.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/critical-rendering-path/#visualization-critical-rendering-path>)

## Sources

1. [Critical Rendering Path](<https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/Critical_rendering_path>) — MDN Web Docs · Official technical documentation
2. [Populating the Page: How Browsers Work](<https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/How_browsers_work>) — MDN Web Docs · Official technical documentation

## Related topics

- [Document Object Model \(DOM\)](<https://wiki.soroush.uk/topic/document-object-model/>)
- [CSS Object Model \(CSSOM\)](<https://wiki.soroush.uk/topic/css-object-model/>)
- [Browser Event Loop](<https://wiki.soroush.uk/topic/browser-event-loop/>)
