Answer
The Critical Rendering Path (CRP) is the sequence of steps the browser performs to turn HTML/CSS/JS into pixels:
- HTML → DOM (parse markup into the DOM tree).
- CSS → CSSOM (parse styles into the CSSOM tree). CSS is render-blocking.
- DOM + CSSOM → Render Tree (only visible nodes with computed styles).
- Layout (reflow) — compute geometry/positions.
- Paint — fill pixels.
- Composite — layer the painted parts to screen.
JavaScript can block parsing (synchronous <script> blocks DOM construction and waits for CSSOM).
Optimizations:
- Inline critical CSS; defer non-critical CSS (
media,preload). defer/asyncon scripts; move scripts to the end.- Minimize and compress resources; reduce the number of render-blocking requests.
- Reduce DOM depth; avoid large reflows.