Skip to the content
Start free

Critical rendering path

The critical rendering path is the set of steps a browser must finish before it can draw the first pixels of a page: read the HTML, read the CSS, combine them, work out the layout and paint the screen. Anything that holds up those steps, such as a large stylesheet or a script in the head, delays the moment a visitor sees your page. Shorten the path and the page appears sooner.

What is the critical rendering path? #

When a browser loads a page it gets 3 kinds of code: HTML for the content, CSS for the look, and JavaScript for behaviour. It cannot show anything useful until it knows both what is on the page and how it should look. The MDN guide breaks the work into 5 steps:

  1. Build the DOM. The browser reads the HTML and turns it into a tree of nodes, the Document Object Model. This can happen bit by bit as the HTML arrives.
  2. Build the CSSOM. It reads every stylesheet into a second tree. This step is not done bit by bit, because a later rule can overwrite an earlier one.
  3. Build the render tree. It joins the 2 trees and keeps only what will show. Anything set to display: none is left out.
  4. Layout. It works out the size and place of each box for the screen in front of it.
  5. Paint. It draws the pixels.

The “critical” part is everything needed for the first view. The rest can wait.

What blocks the path? #

CSS blocks rendering #

web.dev’s article on render-blocking CSS says CSS is treated as render-blocking by default. The browser waits until it has the stylesheets so it does not show an unstyled page. A stylesheet with a media attribute that does not match, such as media="print", does not block the first render. The browser still downloads it, just at a lower priority.

JavaScript blocks parsing #

web.dev’s article on adding interactivity with JavaScript says a script blocks DOM construction unless it is marked async. The browser stops reading HTML, fetches the script and runs it. There is a second catch: because scripts can read styles, the browser also waits for the CSSOM before it runs them. So a script in the head can be stuck behind a stylesheet, and the HTML is stuck behind both.

A slow first view hurts people, and Google measures how pages feel to real visitors through Core Web Vitals. The most closely tied one is Largest Contentful Paint. web.dev’s LCP article says a good score is 2.5 seconds or under, and that you should judge it on the 75th percentile of loads, split by phone and desktop. Nothing can be painted, including the main image or heading, until the render-blocking files are in. A long path pushes LCP up. It also tends to show up as a slow page speed score in Google Lighthouse.

Why does it matter for AI answers? #

Not every crawler waits for scripts to build the page. Some read the raw HTML as text and move on. Google says in its JavaScript SEO basics that server-side rendering or pre-rendering is still a great idea, partly because not all bots can run JavaScript. A lean path usually goes with a page whose main words are in the HTML from the start, which is good for rendering by search engines and for being read by an AI crawler. See JavaScript SEO for more.

How do you shorten it? #

MDN gives 3 aims: fewer critical files, smaller and fewer requests, and the right load order. In practice:

  • Defer scripts. Add defer or async to scripts that are not needed for the first view. Chrome’s render-blocking resources audit flags any head script with neither.
  • Inline critical CSS. Put the few rules needed for the top of the page in a <style> block in the head, and load the rest later.
  • Split CSS by media. Give print or large-screen styles their own file with a matching media attribute.
  • Cut unused code. The Coverage tab in Chrome DevTools shows how much loaded CSS and JavaScript is not used.
  • Minify. Smaller files arrive sooner. Our JavaScript minifier does this in your browser.
  • Keep the DOM small. MDN notes that more nodes slow every later step.
  • Serve fast. A slow time to first byte delays the whole path. Caching and a CDN help.

Common mistakes #

  • Loading 5 font files and 3 sliders in the head for a page that shows one heading first.
  • Adding async to everything. Scripts that depend on each other can then run in the wrong order. defer keeps order.
  • Hiding the main content until a script runs. The page looks blank, and some bots see nothing.
  • Lazy-loading the hero image. Lazy loading helps images lower down, but delays the one that is often the LCP element.
  • Fixing one plugin and adding 2 more. Check again after every change.

A worked example #

A florist’s home page loads 4 stylesheets and 6 scripts in the head. Lighthouse lists 7 of them as render-blocking. The team:

  1. marks 5 scripts as defer, since none are needed before the first paint;
  2. moves the chat widget script to load after the page;
  3. inlines about 40 lines of CSS for the header and hero, and loads the full sheet after;
  4. gives the print stylesheet media="print".

The next Lighthouse run lists 1 render-blocking file instead of 7. Field data from real visitors moves more slowly than a lab test, so they check the Core Web Vitals report in Search Console again a month later.

How to check it #

Sources #

Updated 24 November 2026 by URSY.

Cite this page: Critical rendering path. URSY. Updated 24 November 2026. https://ursy.com/wiki/critical-rendering-path/ · Section links

Tools for this

All 871 wiki entries, A to Z →