Free unused CSS remover

Remove unused CSS from your website

Enter your web address. TrimCSS checks your pages against every rule in your stylesheets and hands you back smaller files, with only the CSS your site really uses.

Scan a website

Pages to check (up to 5 on a free scan)
Options

Separate with commas or spaces. A star matches anything, so swiper-* keeps every class starting with swiper-.

How it works

Three steps to a lighter stylesheet

1

Your pages are read

TrimCSS opens your home page, finds your sitemap and picks a varied set of pages, or uses the pages you list.

2

Every rule is checked

Each selector in each stylesheet is tested against the HTML of those pages. Selectors that match nothing are marked as unused.

3

You download the result

Each stylesheet comes back trimmed and, if you like, minified, with a list of exactly what was removed so you can check it.

Why it matters

Less CSS, faster first paint

A browser cannot show a page until it has downloaded and read every stylesheet in the head. Themes, page builders and frameworks often ship rules for hundreds of components a site never uses, and every one of them is downloaded on every visit.

Trimming that weight shortens the time before visitors see your page, which is one of the things PageSpeed Insights measures and one of the easiest to improve.

Read how the scan decides what to keep

Careful by design

What TrimCSS always keeps

  • Hover, focus, active and other states, judged by the element they style
  • Classes that appear in the site's own JavaScript, such as menu and slider classes added after the page loads
  • Anything you add to the safelist, with wildcards for whole families of classes
  • Media queries, layers and supports blocks that still contain a rule in use
  • Vendor prefixes and declarations exactly as you wrote them

Not live yet?

Trim CSS from code you paste in

Working on a site that is still on your own computer, or behind a login? Paste the HTML and the CSS straight into the Paste CSS tool. It runs entirely in your browser and has no page limit.

Open Paste CSS

Questions

Common questions

What does TrimCSS do?

It reads the pages of your website and the stylesheets they load, checks every CSS rule against the HTML on those pages, and gives you new stylesheets with the rules that match nothing taken out.

Is the free scan really free?

Yes. A free scan checks up to 5 pages of one website and gives you every trimmed stylesheet to download. There is nothing to sign up for.

Will trimming break my website?

The scan only removes selectors that match nothing on the pages it checked, and it keeps hover, focus and other states, classes named in your JavaScript and anything on your safelist. Styles for content that only appears after a click or a login can still look unused, so always test the trimmed file on a copy of your site before replacing the live one.

Does it change my website?

No. TrimCSS only reads public pages, in the same way a browser does. You download the trimmed files and decide whether to upload them.

Does my CSS get stored on your server?

No. Pages and stylesheets pass through our server only so your browser can read them, and the trimming happens in your browser. Nothing you scan is saved.

Can I trim CSS without scanning a live site?

Yes. The Paste CSS tool takes HTML and CSS you paste in, which suits sites that are still on your own computer or behind a login.