Eliminate Render-Blocking Resources: Find and Fix Them

Eliminate render-blocking resources: find blocking CSS and JavaScript, fix them with defer, async, critical CSS and media queries, and verify in a waterfall.

· BugViso Team

15 min read

To eliminate render-blocking resources, find the stylesheets and synchronous scripts in the <head> that stop the browser painting (the Lighthouse "Eliminate render-blocking resources" audit or the DevTools Network panel), then inline critical CSS, load other CSS asynchronously and add defer or async to scripts.

Fixing them improves First Contentful Paint and often LCP.

When external CSS and JavaScript files block the rendering pipeline, First Contentful Paint (FCP), Largest Contentful Paint (LCP) and Speed Index all get slower. To fix this, optimize the Critical Rendering Path, inline critical styles, and defer everything else.

FCP and LCP are part of Core Web Vitals basics, and the full LCP workflow is in how to improve LCP.


The Critical Rendering Path: Why Blocking Resources Halt Painting

To understand why certain assets freeze page rendering, trace how a modern web browser transforms raw HTML, CSS and JavaScript bytes into painted pixels on the screen. That sequence is known as the Critical Rendering Path (CRP).

Diagram
+-------------------------------------------------------------------------+

|                    THE CRITICAL RENDERING PATH (CRP)                    |
|                                                                         |
|  [HTML Bytes] ---> [Tokens] ---> [DOM Tree Construction]                |
|                                         |                               |
|  [CSS Bytes]  ---> [Tokens] ---> [CSSOM Tree Construction]              |
|                                         |                               |
|                                         v                               |
|                                [RENDER TREE CREATION]                   |
|                        (Matches DOM nodes with CSSOM styles)            |
|                                         |                               |
|                                         v                               |
|                                 [LAYOUT COMPUTATION]                    |
|                       (Calculates exact geometric coordinates)          |
|                                         |                               |
|                                         v                               |
|                                  [PAINT & COMPOSITE]                    |
|                         (Draws pixels to device screen)                 |

+-------------------------------------------------------------------------+

The Blocking Mechanism

The browser cannot paint any visual content to the screen until it constructs the Render Tree. The Render Tree requires two distinct data structures:

  1. The Document Object Model (DOM): The tree representation of the HTML markup.
  2. The CSS Object Model (CSSOM): The tree representation of all associated styles and cascading rules.

If the browser encounters an external stylesheet (<link rel="stylesheet">) or a synchronous script (<script src="...">) in the document <head>, it pauses DOM or Render Tree construction until those network requests complete and their contents are evaluated.

Until both models are assembled, the browser displays nothing—leaving the user waiting in front of an empty viewport.


Render-Blocking CSS vs Parser-Blocking JavaScript: Key Differences

While both CSS and JavaScript can delay initial rendering, they block the browser through fundamentally different mechanisms.

Render-Blocking Css Vs Parser-Blocking Js

  • CSS STYLESHEETS | JAVASCRIPT SCRIPTS
  • Blocks Rendering (CSSOM)| Blocks HTML Parser (DOM)
  • DOM construction continues | DOM construction completely halts
  • Browser refuses to paint | Browser stops discovering elements below
  • Prevents FOUC by design | Script can execute document.write()
  • Must be inlined or media-split| Must be deferred or loaded asynchronously

1. Why CSS is Render-Blocking by Default

CSS is intentionally render-blocking to prevent a jarring user experience known as the Flash of Unstyled Content (FOUC). If the browser painted text and structural containers before loading stylesheets, users would see raw unformatted typography for 500ms before styles snapped into place.

However, modern websites frequently load a single massive main.css file containing styles for the entire site, including shopping carts, user dashboards and modals that do not even exist on the landing page.

The browser must download and parse every single rule before it can render a single pixel.

2. Why JavaScript is Parser-Blocking by Default

When the HTML parser encounters a standard <script src="app.js"></script> tag, it cannot know in advance whether the script will execute DOM-modifying APIs such as document.write() or query element coordinates.

Consequently, the HTML parser halts DOM construction entirely, downloads the script file over the network, and executes the JavaScript runtime immediately before resuming HTML tokenization.

The Cssom-Javascript Deadlock

  1. The HTML parser encounters <link rel="stylesheet" href="style.css">, and the browser initiates a background CSS download.
  2. The HTML parser immediately encounters <script src="app.js"></script>. The JavaScript might query computed styles (for example getComputedStyle), so the browser refuses to execute app.js until style.css finishes.
  3. Result: the parser is blocked by JS, and JS is blocked by CSS. The rendering pipeline suffers a compound network stall.

According to Google's render-blocking resources guide, eliminating these critical resource chains directly accelerates First Contentful Paint (FCP) and reduces initial bounce rates.


How to Eliminate Render-Blocking Resources: Finding Them First

Before applying code optimizations, you must audit which specific network assets are responsible for holding back the Critical Rendering Path.

ToolPrimary SignalBest Used For
Chrome DevTools Network Panel"Highest" priority tag in <head> assetsQuick local visual waterfall inspection
DevTools Coverage TabRed unused byte bar (> 40% unused)Measuring dead code in CSS and JS bundles
PerformanceObserver Resource Timing APIrenderBlockingStatus attribute on entriesAutomated production RUM telemetry

Method 1: The DevTools Coverage Panel

The Coverage tab in Chrome DevTools reveals the exact proportion of executed versus unused code on initial page load:

  1. Open Chrome DevTools (F12 or Cmd + Option + I).
  2. Open the Command Menu (Cmd + Shift + P or Ctrl + Shift + P), type Coverage, and select Show Coverage.
  3. Click the reload button. DevTools will record all loaded CSS and JavaScript files, displaying a visual progress bar with red indicating unused bytes.

If your primary stylesheet shows mostly red (unused bytes) on your landing page, that file is unnecessarily blocking first paint with dead weight.

Method 2: Programmatic Audit via Resource Timing

Modern browsers tag render-blocking assets directly within the PerformanceResourceTiming interface:

javascript
// Programmatically inspect all render-blocking resources on the active page
const renderBlockers = performance.getEntriesByType('resource').filter((entry) => {
  return entry.renderBlockingStatus === 'blocking';
});

console.table(
  renderBlockers.map((res) => ({
    'Resource URL': res.name.split('/').pop(),
    'Initiator Type': res.initiatorType,
    'Transfer Size (KB)': (res.transferSize / 1024).toFixed(2),
    'Duration (ms)': res.duration.toFixed(1),
  }))
);

Fix 1: Eliminating Parser-Blocking JavaScript (async, defer, type="module")

To prevent JavaScript from halting the HTML parser, apply non-blocking script attributes to every external script tag in your document.

AttributeDownloadParsingExecution
none (<script src>)Blocks the parserPaused for download and runImmediately, in order
asyncIn parallel with parsingPaused only while it runsAs soon as it downloads, in any order
deferIn parallel with parsingNot pausedAfter parsing finishes, in order

Modern Script Loading Rules

According to the MDN script element documentation, follow these rules when adding JavaScript to your templates:

1. Use defer for Application Logic

Use defer for all scripts that interact with the DOM or depend on other scripts (such as your UI framework, navigation logic, or state managers).

html
<!-- GOOD: Downloads concurrently without blocking HTML parser; executes in order -->
<script defer src="/js/vendor.js"></script>
<script defer src="/js/app.js"></script>

2. Use async for Independent Analytics

Use async only for completely standalone scripts that do not manipulate the DOM or rely on other libraries (such as independent analytics beacons or heatmaps).

html
<!-- GOOD: Non-blocking download; executes as soon as bytes arrive -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script>

3. Native ES Modules (type="module")

Modern scripts written as ES Modules are automatically deferred by default:

html
<!-- GOOD: Automatically deferred and executed in document order -->
<script type="module" src="/src/main.ts"></script>

Fix 2: Critical CSS Inlining and Asynchronous Stylesheet Loading

Because browsers require CSS before rendering, the ultimate solution to render-blocking CSS is splitting styles into critical and non-critical layers.

The Critical Css Architecture

    1. CRITICAL CSS (Above-the-Fold Styles):
      • Header navigation, hero typography, layout grid, banner buttons
      • Size: 8KB - 14KB (fits inside initial TCP Slow-Start packet)
      • Delivery: INLINED directly in <head> inside <style> tags
      • Result: Browser renders above-the-fold content on FIRST PAINT!
    1. NON-CRITICAL CSS (Below-the-Fold Styles):
      • Footer, modals, tabs, product carousels, comment feeds
      • Size: 120KB+
      • Delivery: Loaded ASYNCHRONOUSLY in the background without blocking

The Asynchronous Stylesheet Loading Pattern

To load non-critical stylesheets without blocking the rendering engine, use the widely adopted media="print" pattern with an inline onload switcher:

html
<head>
  <!-- 1. Inline Critical Above-the-Fold CSS (Rendered Instantly) -->
  <style>
    :root { --brand-blue: #0284c7; --text-dark: #0f172a; }
    body { margin: 0; font-family: system-ui, sans-serif; color: var(--text-dark); }
    .hero-container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
    .hero-title { font-size: 2.5rem; line-height: 1.2; font-weight: 700; }
    .hero-btn { background: var(--brand-blue); color: #fff; padding: 0.75rem 1.5rem; border-radius: 6px; }
  </style>

  <!-- 2. Asynchronously Load Non-Critical Stylesheet (Zero Blocking) -->
  <link 
    rel="stylesheet" 
    href="/css/non-critical-components.css" 
    media="print" 
    onload="this.media='all'"
  />

  <!-- 3. Fallback for Users with JavaScript Disabled -->
  <noscript>
    <link rel="stylesheet" href="/css/non-critical-components.css" />
  </noscript>
</head>

How the media="print" Trick Works:

  1. When the browser encounters media="print", it recognizes that these styles are only required for printing the page, so it downloads the file with low priority in the background without blocking screen rendering.
  2. Once the download finishes, the onload event triggers, switching this.media='all', instantly applying the full stylesheet to the rendered DOM.

How to Verify the Fix

Run the page through the Lighthouse "Eliminate render-blocking resources" audit and record a trace before and after. In the waterfall, the first paint should no longer wait on the stylesheet or script you changed, and FCP should move earlier.

Your own before and after is the only number that matters for your page.

For complementary server-side response improvements that ensure rapid HTML delivery, consult our guide on how to reduce Time to First Byte (TTFB).


Fix 3: Modern Code Splitting and Dynamic Imports

Shipping a single monolithic bundle containing every route and administrative module in your application forces visitors to download kilobytes of code they may never use.

Monolithic Bundle Vs Route Chunking

Monolithic bundle (anti-pattern): homepage (40KB) + dashboard (300KB) + admin (600KB) + PDF (800KB) = a total bundle of 1.74 MB, a massive parser-blocking delay.

Route code splitting (best practice): when a visitor lands on the homepage, the browser downloads only homepage-chunk.js (40KB). Other routes are downloaded on demand when the visitor navigates.

Implementing Dynamic Imports in React / Modern JavaScript

Use dynamic imports (import()) and React.lazy() to isolate heavy third-party dependencies (such as chart libraries, rich-text editors, or syntax highlighters) so they are only fetched when their corresponding UI component renders:

tsx
import React, { Suspense, useState } from 'react';

// Heavy analytics chart library loaded ONLY when user toggles the view
const HeavyAnalyticsChart = React.lazy(() => import('./components/HeavyAnalyticsChart'));

export function PerformanceDashboard() {
  const [showCharts, setShowCharts] = useState(false);

  return (
    <div className="dashboard-wrapper">
      <h2>System Performance</h2>
      <button onClick={() => setShowCharts(true)}>Load Visual Telemetry</button>

      {showCharts && (
        <Suspense fallback={<div className="skeleton-placeholder">Loading charts...</div>}>
          <HeavyAnalyticsChart />
        </Suspense>
      )}
    </div>
  );
}

Fix 4: Strategic Resource Hints (preload, preconnect)

The hints are compared in depth in fetchpriority, preload and preconnect, and the full impact-ordered list is in the page speed optimization checklist.

Resource hints allow developers to inform the browser about critical assets before the HTML parser discovers them in the document body.

Resource Hints In The Document Head

    1. PRECONNECT: Resolves DNS, TCP, and TLS handshakes in advance
  • <link rel="preconnect" href="https://fonts.googleapis.com">
  • <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    1. PRELOAD: High-priority fetch for critical assets required on paint
  • <link rel="preload" href="/fonts/outfit.woff2" as="font" crossorigin>
  • <link rel="preload" href="/images/hero.webp" as="image" - fetchpriority="high">

According to the MDN link preload documentation, preloading tells the browser to initiate a high-priority download immediately.

Caution: Preload only 2 to 4 strictly critical above-the-fold assets. Preloading too many resources creates network bandwidth contention that can delay critical CSS.


How BugViso Detects Render-Blocking Overhead and Code Coverage

Inspecting network waterfalls across many pages by hand is slow. When you sign in and scan your site with BugViso, the crawler runs these checks:

  1. Code coverage: it measures unused JavaScript and CSS bytes with Chrome DevTools Protocol coverage and flags files with more than 40% unused code.
  2. Render-blocking assets: it inspects the document <head> on crawled pages for synchronous stylesheets and scripts that delay First Contentful Paint.
  3. Throttled re-loads: it repeats the load under emulated Slow 3G and Fast 3G profiles, which shows how much render-blocking assets hurt slow mobile connections. These are lab measurements, not field data.
  4. Fix list: findings are ranked, with asset URLs, unused byte totals and AI-written fixes, in the report and the branded PDF.

For the full list of what BugViso tests here, see the Core Web Vitals checker.


Common Mistakes When Fixing Blocking CSS and JS

Avoid these frequent engineering traps when eliminating render-blocking assets:

Common MistakeConsequence
Inlining Massive Stylesheets Bloats HTML payload, destroys caching
Using async on Dependencies Race conditions break script execution
Over-Preloading Assets Saturates network bandwidth on load
Omitting <noscript> Tags Breaks styling for non-JS web crawlers

1. Inlining Massive Stylesheets into HTML

Inlining critical CSS is highly effective, but inlining an entire 300KB stylesheet into every HTML response is an anti-pattern.

Inline styles cannot be cached independently by browser caches or CDN edge nodes, resulting in massive HTML payloads that slow down TTFB on repeat navigations. Keep inlined critical styles small.

2. Blindly Applying async to Dependent Scripts

If script-b.js relies on functions declared in script-a.js, using async on both tags will cause race conditions, because async scripts execute the instant they download regardless of markup order. Always use defer for scripts with execution dependencies.

3. Preloading Too Many Non-Critical Assets

Adding rel="preload" to dozens of fonts, background images, and secondary scripts saturates the browser's maximum concurrent connection limit (typically 6 connections per domain on HTTP/1.1), causing critical stylesheets to wait in line.


Frequently Asked Questions About Render Blocking

These answers cover what readers ask most about render-blocking resources.

What are render-blocking resources in Core Web Vitals?

Render-blocking resources are external stylesheets (<link rel="stylesheet">) and synchronous JavaScript files (<script src="...">) located in the document <head> that prevent the browser from constructing the Render Tree until they have finished downloading and parsing.

How do render-blocking resources affect SEO rankings?

Render-blocking resources directly delay First Contentful Paint (FCP) and Largest Contentful Paint (LCP)—both of which are core metrics evaluated in Google's Page Experience ranking signals.

Pages with heavy render-blocking assets suffer lower Core Web Vitals pass rates and higher bounce rates.

What is the difference between async and defer?

Both attributes download scripts in the background without blocking the HTML parser.

However, an async script executes immediately the moment it finishes downloading (potentially interrupting HTML parsing), while a defer script waits until the entire HTML document is parsed and executes in the exact order declared in the markup.

Does inlining CSS eliminate render-blocking overhead?

Yes. When CSS is inlined directly inside a <style> block in the HTML document, the browser does not need to dispatch external network requests to retrieve styling rules, allowing it to construct the CSSOM and paint the initial frame immediately.

How much critical CSS should be inlined in the <head>?

As a best practice, inlined critical CSS should be kept small. A commonly cited guideline is to fit the HTML and critical styling inside the first TCP round trip (the initial congestion window, roughly 14KB compressed), so the browser can paint without waiting for a second round trip.


Summary and Action Plan

Eliminating render-blocking resources requires a disciplined approach to the Critical Rendering Path. Five steps cover it:

  • Inline above-the-fold critical CSS.
  • Load secondary stylesheets asynchronously with media="print".
  • Apply defer or native ES Modules to application JavaScript.
  • Implement route-based code splitting.
  • Preconnect to essential third-party origins.

To find render-blocking assets and unused CSS across your whole site, sign in and run a BugViso performance scan.


Written by

· BugViso Team

Kazi writes BugViso’s guides on website audits, Core Web Vitals, technical SEO, accessibility and AI search. The data in them comes from audits BugViso runs in a real Chromium browser, including our 219-site study of website health.

Found this useful? Share it.

Summarise with AI

Open this guide in your assistant.

Follow BugViso

New guides and audit data as we publish them.

AI visibility tracker

Is your brand in AI answers?

See how often AI assistants mention you, cite your site and rank you against your competitors.

  • ChatGPT
  • Gemini
  • Perplexity
  • Claude
  • AI Overviews
See how it works

See where your site stands

Run a free BugViso audit for SEO, speed, accessibility and AI search readiness — with fixes you can ship today.