Ship only the CSS each page uses
Reduce unused CSS is the Lighthouse and PageSpeed Insights audit that lists stylesheets carrying more than 10 KiB of rules the page didn't use while it loaded. It still runs under that name in Lighthouse 13, as a diagnostic. A stylesheet in the head holds up the first paint until the whole file has arrived and been parsed, so rules the page never uses still cost time. The usual cause is one site-wide stylesheet, or a whole CSS framework, loaded on pages that use a small part of it.
How Lighthouse decides CSS is unused
One load, no interaction
Lighthouse records which rules match an element once a single page load has finished, with nobody using the page. Rules for hover states, open menus, form errors, loading states that are already gone and other pages all count as unused.
Small amounts are ignored
A stylesheet appears only when its unused rules come to more than 10 KiB, estimated at the file's compressed size, whatever their share of the file. The allowance exists so that hover styles and similar rules a plain load never triggers don't fail the audit on their own.
Transfer Size
How big each listed stylesheet was over the network.
Est Savings
The part of that download taken up by rules the load never used.
The 10 KiB allowance and the columns come from the audit's current source code, the compressed estimate from its unused CSS calculation, and the moment rules are read from the CSS usage gatherer. Chrome's unused CSS guide still gives 2 KiB as the limit and describes the fixes.
Why a stylesheet ends up mostly unused
Unused CSS usually comes from loading everything everywhere: one bundle with every page's styles, a component library imported whole, or theme and plugin stylesheets added to every page. Chrome's Coverage panel guide uses Bootstrap as its example, where a page that needs only the button styles still downloads the CSS for every other component.
The cost goes beyond the download. Stylesheets must be loaded and processed before the browser renders the page, as web.dev's guide to deferring CSS explains, so a stylesheet twice the size it needs to be delays the first paint on every page that links it.
How to reduce unused CSS
- Record coverage while you use the pageOpen the Coverage panel in DevTools, filter it to CSS and reload. Then hover over links, open the menu and submit a form so their rules register as used. Rules still unused after that are the safe place to start.
- Split styles by page or templateMove rules that only one page or section uses into a stylesheet that only that page loads. Keep the shared stylesheet to layout, type and the components every page has.
- Strip dead rules at build timeIf you use a utility framework or a component library, configure its build to keep only the classes your templates use. Check classes your scripts add at runtime first, since a build step that only reads templates can drop styles they need.
- Defer what the first view doesn't needInline the small set of rules for the first screen and load the full stylesheet without blocking. web.dev's guide to deferring CSS shows a preload link that turns into a stylesheet once it has loaded.
- Run Lighthouse on more than one pageTest the home page, a long article and a form page. A stylesheet that looks lean on one template can be mostly unused on another.
Frequently asked questions
Why does Lighthouse say CSS is unused when my site needs it?
The audit sees one page load and no interaction. Styles for other pages, hover states, open menus and error messages haven't matched anything yet. Those rules still belong somewhere, just not in a stylesheet that every page has to load before it can paint.
Should I inline all my CSS to fix it?
No. Inlining everything moves the same bytes into every HTML response, where browsers can't cache them apart from the page. Inline only the rules the first screen needs and keep the rest in a cached file, as web.dev's guide to deferring non-critical CSS shows.
Do I have to remove every unused rule?
No. The audit already allows up to 10 KiB of unused rules per stylesheet. Start with the stylesheets showing the largest Est Savings and stop once they drop off the list.
Clear the CSS and scripts that hold up the first paint
- Website speedFind what makes your pages slow enough that visitors leave.
- Render-blocking resourcesBring useful content into view sooner by changing how CSS, scripts and fonts load.
- Unused JavaScriptFind the code your scripts ship but never run on load, then split it out or delete it.
- Page sizeReduce download weight and page complexity by removing code and content you no longer need.