Reduce unused CSS: give each page only the CSS it uses
Which stylesheets Lighthouse lists, why a file you need can be on the list, and how to stop loading CSS on the pages that don't use it.
Why does Lighthouse say your CSS is unused?
Reduce unused CSS, called Remove unused CSS until 2021, means a stylesheet on your page has more than 10 KiB of rules that matched nothing right after the page loaded. Mostly that is CSS for things this page doesn't have, and your visitor waits for it before seeing anything. Load each plugin's CSS only where it is used, and leave Remove Unused CSS off.
Just want the quick fix? Jump to WordPress, Remove Unused CSS in WP Rocket, Shopify or your own stylesheet.
Which CSS does Lighthouse call unused?
The full notice reads: "Reduce unused rules from stylesheets and defer CSS not used for above-the-fold content to decrease bytes consumed by network activity."

A brewery's taproom page in Lighthouse on mobile, with the simulated throttling PageSpeed Insights uses.
Lighthouse waits until your page has loaded, then checks every CSS rule against the page as it is at that moment: at a phone's screen width, with nobody tapping or scrolling. A rule that matches an element is used, even when that element is far below the first screen. A rule that matches nothing is unused: hover styles, the open menu, the cart drawer, the layout for wider screens, print styles.
So your menu's CSS can be on this list and still be needed after the first tap. That is why Lighthouse lists a file only above 10 KiB unused (compressed). The files worth your time hold CSS for things this page doesn't have.
Transfer Size is the stylesheet's compressed download, Est Savings the part that matched nothing. A line with CSS code instead of a URL is a <style> block in the page itself, often a consent banner's (which lines can stay).
Lighthouse shows the notice in red when a listed file sits in the page's head, so the first paint (FCP) and your largest element (LCP) wait for it. Orange means the page paints without waiting for that file, as with CSS a script adds after the page is on screen. Unscored: Lighthouse gives this notice no points of its own, but FCP and LCP count, and Google ranks on your real visitors' numbers.
Does unused CSS slow down your page?
Your visitor looks at a white screen longer, and the large photo arrives later. Every stylesheet in the head has to arrive before the browser paints anything (Render-blocking requests explains why), and those downloads share the phone's connection with the photo. The unused rules download like the rest; matching them takes the browser little time.
I measured it on a brewery's taproom page set up as a typical WordPress site: a theme on the full Bootstrap framework, WooCommerce for the beer shop, and a form, a slider and an icon font that load on every page. Over a slow phone connection:
| Taproom page | CSS download | First paint | LCP photo |
|---|---|---|---|
| Before | 104 KiB, 12 files | 1.23 s | 1.30 s |
| Only the theme's CSS | 43 KiB, 3 files | 0.96 s | 1.00 s |
| Theme trimmed too | 14 KiB, 2 files | 0.89 s | 0.89 s |

Before

After
At one second: before, and with the theme trimmed too.
The finished page looks the same in every row. The gain is this large because the page had over 100 KiB of compressed CSS in its head; one 20 KiB stylesheet that is 60% unused would gain a few tens of milliseconds. According to the State of Web Vitals, the median home page leaves 88% of its CSS unused.
Whose stylesheet is it?
The URL tells you. On WordPress, /wp-content/plugins/ plus a name is that plugin, /wp-content/themes/ your theme and /wp-includes/ WordPress itself. Lines you will often find:
- An icon font such as Font Awesome, dashicons or Genericons: 12 to 36 KiB compressed for a page that shows a dozen icons or none.
- WordPress's block library (
block-library/style.min.css): since WordPress 6.9 a classic theme loads only the CSS of the blocks on the page. If the whole file is listed, a plugin or the theme switched that off; Elementor does. - WooCommerce loads its stylesheets on every page, shop or not.
- Your theme's framework: a theme built on the full Bootstrap sends about 30 KiB of it for a grid and a few buttons.
- Consent banners and apps: a consent banner such as Google's or OneTrust's adds a
<style>block, and Shopify apps such as Yotpo and Rebuy load stylesheets of their own, often from the app's own domain.
Coverage in Chrome DevTools shows every stylesheet's full URL and unused bytes; Reduce unused JavaScript shows how to open it.

Coverage on the taproom page before the fix: grey is unused, green is used.
Coverage also shows files too small for the notice, such as animate.css and WooCommerce's smaller stylesheets. In the head they delay the first paint just the same.
Should you switch on Remove Unused CSS?
On a site with WP Rocket, PageSpeed Insights adds: "Enable Remove Unused CSS in 'WP Rocket' to fix this issue." It clears the notice, which is why Lighthouse recommends it. Perfmatters and FlyingPress have the same setting; LiteSpeed Cache calls it Generate UCSS.
These features load each page once, keep the rules that matched something, and usually put them inside the HTML. The original stylesheets are removed, or loaded when the visitor first taps or scrolls. Your visitor gets:
- that CSS again with every page view, because the HTML isn't cached the way a stylesheet is;
- a menu, cart drawer or popup without its styles when the scan missed it, or all the original CSS at once on the first tap;
- the full CSS on a new or edited page until the plugin has processed it, which is also why the notice can stay.
An online tool that removes unused CSS for one URL works the same way: it keeps only the rules that page used when the tool loaded it, so the styles for your other pages and for a menu that opens on a tap are gone.
Leave Remove Unused CSS and critical CSS off: they are more hassle than they are worth. Critical CSS, WP Rocket's Load CSS asynchronously, puts the first screen's styles in the HTML and the rest after the first paint. With very aggressive caching that can be very fast, but it is hard to maintain, often makes the page shift and is slower on the next page view. If either is on, switch it off and follow the WordPress steps.
How do you fix Reduce unused CSS?
Take the biggest file you control first, and remove whole files before you trim rules: a file for something the page doesn't have is unused from the first byte to the last.
WordPress
- Switch a plugin's CSS off where the page doesn't use it. Asset CleanUp (free, menu "CSS/JS Manager") and Perfmatters' Script Manager (paid) switch a stylesheet off per page, per post type or everywhere except a few pages. Use their test mode first: then only you see the change. Start with WooCommerce outside the shop, an icon font where no icon shows, and a slider's or form's CSS on pages without one. This gave most of the taproom page's gain.
- Use your builder's or theme's setting. Elementor: Inline Font Icons (Settings, Features) draws icons as SVG without the Font Awesome file; Optimized Gutenberg Loading (Settings, Performance) drops the block library on Elementor pages without blocks. Divi: Dynamic CSS and Dynamic Icons (Theme Options, General, Performance). Splitting CSS per widget or per section, as Elementor does, clears this notice and brings dozens of stylesheets instead; the goal is the CSS the page uses in files of about 15 kB (Render-blocking requests).
- Then combine what's left. WP Core Web Vitals, my own plugin, puts the stylesheets a page still loads into files of 12 to 14 kB. Combining before you switch files off puts the same unused CSS into one bigger file, which Lighthouse lists.
- Test as a visitor. Log out (the admin bar brings its own CSS) and check the menu, the mini-cart, the footer and every form on the pages you changed.
- What undoes it. A plugin update can rename a stylesheet so it loads again, and a new plugin often loads its CSS everywhere: check the list after each one.
- Where this stops. The theme's own framework stays: on the taproom page Bootstrap was still listed with every plugin's CSS off. Ask the theme's developer for a build with only the parts the theme uses, and send the notice's URLs with the percentages from Coverage. That is several days of work.
In code, wp_dequeue_style switches a file off, and WooCommerce has the woocommerce_enqueue_styles filter; Render-blocking requests has an example.
Shopify
Current themes such as Dawn and Horizon load a section's CSS only on the pages that show that section, so the listed file is usually an app's or a consent banner's. In the theme editor, under App embeds, switch off the embeds you don't use, and uninstall apps you stopped using. A removed app can leave code behind: search layout/theme.liquid and the snippets for its name. For an app that loads a big stylesheet on every page, ask its developer to load it only where the app shows. If the theme's own stylesheet is listed, moving rules into the sections that use them is a job for a Shopify developer.
Your own stylesheet: Bootstrap, Tailwind, PurgeCSS, Next.js
With Bootstrap, import only the parts the theme uses; Sass joins them into one file when you build, so the browser gets no @import:
// Bootstrap 5.3: only the parts this theme uses
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/variables-dark";
@import "bootstrap/scss/maps";
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/utilities";
@import "bootstrap/scss/root";
@import "bootstrap/scss/reboot";
@import "bootstrap/scss/type";
@import "bootstrap/scss/containers";
@import "bootstrap/scss/grid";
@import "bootstrap/scss/tables";
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/transitions";
@import "bootstrap/scss/nav";
@import "bootstrap/scss/navbar";
@import "bootstrap/scss/card";
@import "bootstrap/scss/utilities/api";
- Tailwind generates only the classes it finds in your files. Write class names in full, or list the ones your code puts together (
bg-${color}-600) with@source inline(). - PurgeCSS reads your templates as text and removes every selector it doesn't find there, including classes a script adds (
is-open, a slider's) and classes in your CMS content. Put those in itssafelist. - Next.js: a CSS Module goes only to the routes that import it, a stylesheet imported in the root layout to every route. Keep CSS for one kind of page out of the layout.
A shared file of about 15 kB, compressed, can be partly unused on each page, because the browser caches it after the first one: the taproom page passed with its trimmed theme file still 75% unused by Lighthouse's count.
Loading CSS later or inline
Loading the CSS asynchronously, with the media="print" trick, leaves the files on the list, and the page paints first without its styles, then shifts as they arrive. An "inline CSS" setting moves the same CSS into the HTML, where Lighthouse lists it as a line of code and every page view downloads it again.
How do you know the fix worked and nothing broke?
Run Lighthouse again the same way, with its default simulated throttling. Then record Coverage while you open the menu, hover over the buttons, open the cart and make the window wider. A file whose unused share drops holds CSS for those moments: keep it.

CoreDash on mobile: p75 LCP per URL, with its trend.
For your real visitors, find the pages where you switched CSS off and watch their Trend in the days after the change: with less CSS before the first paint, LCP goes down. Search Console takes up to 28 days to show it.
Which lines can stay?
A consent banner's line can stay: the banner has to be there, so know what its CSS adds to every page. The same goes for an app you keep because it sells, and for your own shared stylesheet of about 15 kB. Fix every other line.
When most of the list is your theme's framework, or a page builder whose CSS nobody can take apart without breaking pages, book a power hour. We open your report and Coverage side by side and decide which CSS goes, from which pages, and who does the work.

Need a faster site?
I'm Arjen, and I've been fixing slow sites for 17 years. If you're running into issues you can't fix yourself, send me your URL and let's have a chat.
Send me your URL
Why isn't our fix working?
Sometimes the CDN still serves the old HTML, or the fix went into the desktop template and mobile uses another one. Send me your URL and the problem, and I reply with a few times. I check your field data first, then we spend one hour on your site, and within a day you have my notes in writing. €350 excl. VAT.
Send me your URLNo developer to build the fix? I do the work myself, on a copy of your site.