Start a project

Tool 52 of 194 · CSS

Unused CSS Finder

Paste a few pages and your stylesheet to see which selectors, keyframes, fonts and custom properties nothing uses, with a safelist for classes JavaScript adds.

Unused CSS Finder at a glanceIllustration: 1, Pages; 2, processed in your browser; 3, Purged CSS.Unused CSS Finder1Pages−++3Purged CSS2In yourbrowser
1 Pages 2 processed on your device 3 Purged CSS

Unused CSS Finder

Your pages and stylesheet

    Unused and kept

    Red is removed from the purged file; blue is kept by the safelist or a script.

    SelectorLineWhy

    Per page

    PageElementsSelectors usedUsed only here

    Purged CSS

    Purged stylesheet

    01

    What it does

    Tests every selector against several pages, reports what matches nothing and writes a purged stylesheet that keeps your formatting.

    • Every selector tested against every page you paste or load
    • :hover, :focus and ::before stripped before testing, so they count when the element exists
    • Selector lists trimmed rather than whole rules dropped
    • Unused @keyframes, @font-face and custom properties

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Unused selectors with reasons, per-page coverage, raw and gzipped savings and a purged file, with a Copy and a Download button on every result.

    • CSS
    • Performance
    • Unused CSS
    • PurgeCSS

    Why it matters

    Stylesheets only grow. Components get deleted but their CSS stays, frameworks ship every utility, and every byte of CSS blocks rendering. Lighthouse's "reduce unused CSS" checks one page at a time, so CSS used on the product page looks unused on the home page, and tools like PurgeCSS need a build step and regularly strip classes that JavaScript adds later.

    This finder parses your stylesheet, including nesting, layers and media queries, and tests each selector against every page you give it, after removing states such as :hover and pseudo-elements such as ::before so that a:hover counts as used when the page has links. Selector lists are trimmed to the parts that match, nested rules go with their parents, and @keyframes, @font-face rules and custom properties nothing refers to are flagged. Strings in the pages' own scripts are scanned so a menu-open class toggled by JavaScript is kept, and a safelist covers the rest. The purged file is written by editing your original source, so comments and formatting survive, and it shows raw and gzipped sizes before and after.

    How it works

    1. InputSeveral pages and a stylesheet
    2. In your browserEvery selector tested on every page
    3. OutputUnused rules and a purged file

    Where it fits in a designer's workflow

    1. Plan
    2. Design
    3. Build
    4. Test
    5. Launch
    Cutting render-blocking CSS before a launch or redesign.

    By the numbers

    Selectors used on each sample pageHome: 12 selectors used, 3 only here; Product: 13 selectors used, 4 only here; About: 7 selectors used, 1 only hereAll 30Home12 selectors used, 3 only hereProduct13 selectors used, 4 only hereAbout7 selectors used, 1 only here
    Computed by this tool from its sample: no single page uses more than half of the 30 selectors, which is why a one-page coverage report overstates unused CSS. Across all three pages 10 selectors match nothing, and purging them takes the file from 1,810 to 1,322 bytes. Source: Chrome for Developers: Remove unused CSS; web.dev: Defer non-critical CSS.
    Show the numbers as a table
    PageElementsSelectors usedUsed only here
    Home10123
    Product12134
    About871

    How to use it

    1. Paste a few representative pages separated by ---, or add saved .html files.
    2. Paste the stylesheet.
    3. Add classes that JavaScript adds to the safelist.
    4. Check the list, then copy or download the purged CSS.

    FAQ

    How many pages should I paste?

    One of each template: home, a listing, a product or article, a form, and anything with modals or menus. CSS used only by a template you leave out will look unused.

    Will it remove my :hover styles?

    No. States and pseudo-elements are removed before testing, so .btn:hover is kept whenever a .btn exists.

    What about classes added by JavaScript?

    Strings inside the pages' scripts are scanned and matching classes are kept. For anything else, such as classes from a framework or a CMS, add names, wildcards like is-* or regular expressions to the safelist.

    Is the purged file safe to ship?

    Review it first: it's only as complete as the pages you gave it. Test the pages it was made from, and the states your scripts add.

    Why does gzipped size matter?

    Servers send CSS compressed, so the gzipped saving is what users actually download. Repetitive CSS compresses well, so the real saving is smaller than the raw one.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk