Fix Render-Blocking Resources: A Complete Guide
Learn how to identify and eliminate render-blocking CSS and JavaScript that delay your page from displaying content. Step-by-step guide with code examples.
Lighthouse flags "Eliminate render-blocking resources" when CSS or JavaScript in your <head> delays the browser from rendering any visible content. This is one of the highest-impact optimizations you can make.
Why It Matters
Every render-blocking resource adds network latency before your users see anything. On a 3G connection, a single 50KB CSS file can add 800ms–1.2s to your First Contentful Paint.
If you're running paid ads, that delay directly costs you money. A 1-second delay in page load reduces conversions by approximately 7%.
How to Identify Render-Blocking Resources
- Run a Lighthouse audit (or use BadPageSpeed's dashboard)
- Look for the "Eliminate render-blocking resources" opportunity
- It lists every CSS and JS file blocking the initial render
How to Fix It
Step 1: Inline Critical CSS
Extract the CSS needed for above-the-fold content and inline it directly in the HTML:
<head>
<style>
/* Only the CSS needed for the initial viewport */
body { margin: 0; font-family: system-ui; }
.hero { padding: 2rem; background: #1a1a2e; }
.hero h1 { color: white; font-size: 2.5rem; }
</style>
</head>
Tools like Critical can automate this extraction.
Step 2: Defer Non-Critical CSS
Load the full stylesheet asynchronously using the media trick:
<link rel="stylesheet"
href="/styles.css"
media="print"
onload="this.media='all'">
<noscript>
<link rel="stylesheet" href="/styles.css">
</noscript>
Step 3: Async/Defer JavaScript
Add async or defer to script tags that aren't needed for the initial render:
<!-- Defer: executes after HTML parsing, in order -->
<script src="/analytics.js" defer></script>
<!-- Async: executes as soon as downloaded, out of order -->
<script src="/widget.js" async></script>
Use defer for scripts that depend on DOM or each other. Use async for independent scripts like analytics.
Step 4: Remove Unused Code
If a CSS or JS file isn't needed on a particular page, don't load it there. Use route-based code splitting in frameworks like Next.js or dynamic imports:
// Only load when needed
const Chart = dynamic(() => import('./Chart'), { ssr: false });
Measuring Your Fix
After implementing these changes, run another Lighthouse audit. You should see:
- FCP improvement: 0.5–3s faster
- LCP improvement: Often improves alongside FCP
- Render-blocking audit: Should show as passed (green)
Key Takeaway
The fastest resource is one the browser doesn't have to wait for. Inline what's critical, defer what's not, and remove what's unused.
Ready to stop wasting ad spend?
Track your landing page performance, monitor Core Web Vitals, and calculate exactly how much slow pages cost you.
Start Free — No Credit Card