How to Get Critical Rendering Path Right
The sequence of work a browser must complete before it can render anything useful.
On this page
The key figures
- Steps
- HTML parsing, CSS object model construction, render tree, layout, paint
- Render-blocking
- CSS in the head blocks rendering by default
- Parser-blocking
- synchronous scripts block HTML parsing
- Script attributes
- defer and async change when scripts execute
- Critical CSS
- inlining the styles needed for the initial view
Why this is worth getting right
Understanding it is what separates targeted optimization from guesswork, because it identifies what is actually blocking the first paint.
Do this, not that
Do
- Minimize render-blocking CSS in the head
- Use defer for scripts that do not need to run during parsing
- Inline the CSS needed for the initial viewport where it helps measurably
- Preconnect to critical third-party origins
- Measure rather than assuming which resource blocks
Don’t
- Synchronous scripts in the head
- One large stylesheet covering the whole site loaded on every page
- Inlining so much CSS that the HTML becomes the bottleneck
- Optimizing without profiling
When to bring in help
Our advice Bring in help when first paint is slow and the cause is unclear, when a framework controls the loading order, or when optimization has stopped producing gains.
Where this comes from
- web.dev — Critical rendering path
- MDN Web Docs — Script loading attributes
- Chrome for Developers — Performance panel
The figures and practices above come from the sources listed.
Working on something like this?
We take on Performance & Accessibility work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.