BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

Critical rendering path: How browsers draw a page

The critical rendering path is the work a browser must finish before it shows anything. Shorten it and visitors see your content sooner.

Monthly searches · critical rendering path
1.3k
Keyword research data
critical rendering path
Critical rendering path: How browsers draw a page
Click the image to view it full size

The critical rendering path is the sequence of steps a browser goes through to turn HTML, CSS and JavaScript into pixels on the screen, up to the moment the page first appears. Anything the browser must download and process before that first render sits on the critical path, and while the path is unfinished the screen stays blank.

That's why it comes up whenever a page feels slow or scores badly on Largest Contentful Paint: the main content can't paint until the path is done.

The steps from HTML to pixels

The browser works through five steps:

  1. Build the DOM. It parses the HTML into the Document Object Model, a tree of every element. This happens bit by bit as the HTML arrives.
  2. Build the CSSOM. It parses the CSS into the CSS Object Model. Unlike the DOM, this can't be used half-finished, because a later rule can override an earlier one.
  3. Combine them into the render tree. This holds only what will be visible: the <head> and elements with display: none are left out.
  4. Lay out the page. The browser works out the size and position of every element.
  5. Paint. It fills in the pixels on the screen.

When JavaScript changes the page later, parts of this work run again.

What holds up the first render

Not every file blocks the first render. The browser waits for:

  • the first part of the HTML;
  • CSS in the <head>, because CSS is render-blocking by default;
  • JavaScript in the <head> that isn't marked async or defer.

It generally doesn't wait for fonts, images, the rest of the HTML, scripts outside the <head> that don't block, or stylesheets whose media attribute doesn't match the current screen (media="print", for example).

Scripts are the usual trouble. A plain <script src> is parser-blocking: the browser stops reading the HTML until the script has downloaded and run. Two attributes change that:

Attribute When the script runs Order kept?
defer After the HTML is parsed, before DOMContentLoaded Yes
async As soon as it has downloaded No

Scripts with type="module" are deferred by default. A newer attribute, blocking="render", does the opposite: it lets you mark a <link>, <script> or <style> as render-blocking on purpose.

While the main parser is blocked, browsers run a second parser, the preload scanner, that looks ahead and starts downloading files it finds in the HTML. It can't see images set with CSS background-image, HTML that JavaScript renders, or stylesheets loaded with CSS @import.

Google's ranking systems use Core Web Vitals, and the critical path feeds straight into the loading one, Largest Contentful Paint. But Google also says it ranks the most relevant content first, even when page experience is weaker. A shorter critical path makes a good page faster; it won't lift a page that doesn't answer the search.

How to shorten the critical path

Work on three things: fewer critical files, smaller ones, and an earlier start.

  • Defer what isn't needed for the first view. Add defer to scripts that don't need to run before the page shows, and async to independent ones such as analytics.
  • Split CSS by media. Styles for print or wide screens can load without blocking a phone.
  • Make CSS smaller. Minify it and remove rules the page doesn't use. The Coverage tool in Chrome DevTools shows unused CSS and JavaScript.
  • Avoid @import in CSS. Use <link> elements so stylesheets download in parallel.
  • Inline critical CSS, with care. Putting the styles for the first view in the <head> saves a request, but a lot of inline CSS makes every HTML response bigger.
  • Put important files in the HTML. Reference your main image and stylesheets in the markup the server sends, so the preload scanner finds them early.
  • Get the HTML sooner. Everything waits on the first bytes of HTML, so a slow time to first byte delays the whole path.

Here's a <head> that keeps the path short:

<head>
  <link rel="stylesheet" href="main.css">
  <link rel="stylesheet" href="print.css" media="print">
  <script src="app.js" defer></script>
  <script src="analytics.js" async></script>
</head>

How to find what's blocking your page

Measure before you change anything. A few extra elements won't make a big difference; one large blocking script can.

  • Lighthouse flags a render-blocking resource only if it actually delays rendering, so it avoids false alarms. Its critical request chains audit shows which files load others.
  • WebPageTest marks render-blocking resources with an orange circle in its waterfall.
  • Chrome DevTools shows the order files load in on the Network panel and unused code in Coverage.

Fix the biggest blocker first, then measure again.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.