frameworkEngineering & architecture

Critical Rendering Path

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

Download Markdown (.md)

01What 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.[1][2]

Browser rendering dependencies Content becomes pixels through dependent stages
  1. 01Parse HTMLDOM · discover resources
  2. 02Parse CSSBuild CSSOM
  3. 03Compute stylesVisible render data
  4. 04LayoutCalculate geometry
  5. 05Paint + compositeProduce pixels

Scripts, styles, mutations, and browser details can block or repeat stages.

02Why 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.

03When 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.

04How 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.

05A practical example

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.

06Where 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.

07Sources

  1. Critical Rendering PathMDN Web Docs · Official technical documentationCritical Rendering Path
  2. Populating the Page: How Browsers WorkMDN Web Docs · Official technical documentationPopulating the Page: How Browsers Work
View saved topics

Start typing to search titles, definitions, categories, and frameworks.