Skip to the content
Start free

Unused CSS

Unused CSS is style code that a page downloads but never applies to anything on that page, such as rules for a slider, a checkout or a theme option you do not use. It costs bytes and browser work before the first paint, so it slows the page without giving the visitor anything back.

What is unused CSS? #

CSS is the language that sets layout, fonts and colours. A stylesheet holds rules, and each rule targets parts of the page with a selector. If no element on the page matches a selector, that rule is unused on that page. Most sites carry a lot of it. A theme ships styles for every layout it offers. Each plugin adds its own file. A framework adds classes for buttons, grids and forms you may never use.

Unused is always “unused on this page, in this state”. A rule for the basket drawer is unused on the home page until someone opens the drawer. That is why the fix is rarely “delete it all”. It is usually “send it only where and when it is needed”.

Why does it slow a page down? #

Stylesheets are render-blocking by default. Chrome’s guide to the Remove unused CSS audit says the browser has to download, parse and process every external stylesheet it meets before it can show content. Each file is another network request. Unused rules also slow style work: the browser checks which rules apply to each part of the DOM, so more rules can mean more calculation.

The cost lands on the critical rendering path. That means a later First Contentful Paint and often a later Largest Contentful Paint, one of the three Core Web Vitals. On a slow mobile connection, a large theme stylesheet can be the single biggest wait before anything appears.

Speed is part of page speed and of the page experience Google describes. Unused CSS is rarely the reason a page ranks or does not rank. It matters because it is one of the cheaper, safer speed fixes, and slow pages lose visitors before they read a word. Keep one rule in mind: do not block CSS files in robots.txt to “save crawl”. Google’s JavaScript SEO basics explain that Googlebot renders pages in headless Chromium, and blocked files cannot be used when it renders. Trimming CSS is fine. Hiding it from crawlers is not.

Why does it matter for AI answers? #

Most AI crawlers read the HTML and the text, not your styles, so unused CSS does not hide content from them. The link is indirect. People who arrive from an AI answer have already read a summary and click to check one detail. If the page is blank for 3 seconds while a theme file loads, they go back. A fast first paint keeps the visit that AI referral traffic sends you.

How does Lighthouse flag it? #

In Lighthouse and PageSpeed Insights, the audit lists stylesheets where the possible saving is 2 KiB or more, according to Chrome’s own documentation. It shows each file, its transfer size and the estimated bytes you could save. The figure is an estimate for that one page load. It does not know which rules other pages, or other states of the same page, still need.

How do I find it? #

  1. Open Chrome DevTools and run the Show Coverage command. Chrome’s Coverage tab guide explains the steps.
  2. Click Reload in the panel. It records the code the page needs to load, and keeps recording while you click around.
  3. Filter to CSS. Each row shows total bytes, unused bytes and a bar: grey for unused, green for used.
  4. Click a file to open it in Sources. Unused lines are marked beside the line numbers.
  5. Note the file address. On a WordPress site the path usually names the theme or plugin that loaded it.

Open menus, tabs and pop-ups while recording. Otherwise the rules for those states show as unused, and you might delete something real.

How do I fix it? #

  • Load styles only where they are used. Chrome’s audit advice for WordPress and Joomla is to cut the number of plugins and extensions that load unused CSS, or switch to lighter ones. A contact form plugin should not load on every product page.
  • Inline the critical CSS. Put the few rules needed for the first screen in a <style> block in the HTML head.
  • Defer the rest. web.dev’s guide to deferring non-critical CSS shows a rel="preload" link that becomes a stylesheet once loaded, with a noscript fallback. In its example, First Contentful Paint fell by 0.2 seconds. It also warns this is an advanced technique that can bring bugs if done wrong.
  • Split by media query. Chrome’s render-blocking guide says that with a media attribute on each link, the browser only blocks the first paint for stylesheets that match the device. Print styles do not need to hold up a phone.
  • Strip rules at build time. PurgeCSS reads your content files, matches the selectors they use and removes the rest. It lets you safelist selectors by name or pattern.
  • Then minify and compress. Minification and gzip or Brotli shrink what is left. They do not remove unused rules.

Common mistakes #

  • Trusting one page. Coverage on the home page says nothing about the checkout. Test each page type.
  • Purging classes added by script. If JavaScript adds a class like is-open, a build tool that only reads HTML may delete it. Safelist those classes.
  • Breaking the layout to win a score. A missing rule can cause layout shift or a broken menu. Check by eye on a phone after every change.
  • Forgetting the cache. After a change, clear any page or edge cache, or you will test the old files. See cache purge.
  • Chasing small numbers. 3 KiB of unused CSS is not your problem if a 2 MB hero image is.

A worked example #

A small online shop runs WordPress with a page builder and 14 plugins. These numbers are made up to show the idea.

Stylesheet Size Unused on product page Fix
Theme main.css 180 KiB 85% Inline critical CSS, defer the rest
Slider plugin 40 KiB 100% Load on the home page only
Form plugin 22 KiB 100% Load on the contact page only
print.css 8 KiB 100% Add media="print"

After the change, the product page sends far less CSS before first paint. The shop tests the home page, a product, the basket and checkout on a phone, then clears the cache and runs the audit again.

How to check it #

Questions #

Should I aim for 0% unused CSS? #

No. Shared files will always hold rules for other pages. Aim to cut what blocks the first paint.

Is unused CSS the same as unminified CSS? #

No. Unminified CSS has extra spaces and comments. Unused CSS is whole rules nothing uses. Fix both.

Will a caching plugin fix it? #

Some combine and defer files, which helps. Few know which rules a page needs. Test after turning it on.

Sources #

Updated 25 November 2026 by URSY.

Cite this page: Unused CSS. URSY. Updated 25 November 2026. https://ursy.com/wiki/unused-css/ · Section links

Tools for this

All 871 wiki entries, A to Z →