Home Unused CSS    

Remove unused CSS




Find unused CSS in



How it's working


Clean unused CSS selectors
A web crawler follows the links of your site. On each page, we retrieve the CSS files and list the selectors. The selectors are tested on the html page. If the selector matches an element, it is marked as used. When all the files have been visited, a new css file with only the used selectors is built. That's the file you can download. It will also explore pages behind a login.

Features

  • Explore the pages of your site automatically, find the unused CSS selectors and create new clean CSS files you can download
  • Authenticate and explore the pages requiring authentication. It will then check unused CSS rules.
  • Search for CSS rules in javascript files
  • Customize the list of CSS selectors to keep
  • Preview the change made to the CSS file
  • Follow CSS import commands
  • Explore responsive design rules, media queries
  • Set a user agent for the crawler

Similar services

CSS Scanner scans your projects (HTML, ASPX, PHP, JavaScript, jQuery) use of css classes and selectors and compares it to your CSS/stylesheet files. It then lists you those CSS selectors and classes that are not used or not defined and those which are used. There's a precompiled .msi installer for Windows avaliable for download. Just install and find CSS Scanner in your start menu folder "CSS Scanner".

Latish Sehgal has written a windows application to find and remove unused CSS classes. I haven't tested it but from the description, you have to provide the path of your html files and one CSS file. The program will then list the unused CSS selectors. From the screen-shot, it looks like there is no way to export this list or download a new clean CSS file. It also looks like the service is limited to one CSS file. If you have multiple files you want to clean, you have to clean them one by one.

Dust-Me Selectors is a Firefox extension (for v1.5 or later) that finds unused CSS selectors. It extracts all the selectors from all the style-sheets on the page you're viewing, then analyzes that page to see which of those selectors are not used. The data is then stored so that when testing subsequent pages, selectors can be crossed off the list as they're encountered. This tool is supposed to be able to spider a whole website but I unfortunately could make it work. Also, I don't believe you can configure and download the CSS file with the styles removed.

Topstyle is a windows application including a bunch of tools to edit CSS. I haven't tested it much but it looks like it has the ability to removed unused CSS selectors. This software costs 80 USD.

Liquidcity CSS cleaner is a php script that uses regular expressions to check the styles of one page. It will tell you the classes that aren't available in the HTML code. I haven't tested this solution.

Deadweight is a CSS coverage tool. Given a set of style-sheets and a set of URLs, it determines which selectors are actually used and lists which can be "safely" deleted. This tool is a ruby module and will only work with rails website. The unused selectors have to be manually removed from the CSS file.

Helium CSS is a javascript tool for discovering unused CSS across many pages on a web site. You first have to install the javascript file to the page you want to test. Then, you have to call a helium function to start the cleaning.

CSSESS is a bookmarklet that helps you find unused CSS selectors on any site. This tool is pretty easy to use but it won't let you configure and download clean CSS files. It will only list unused CSS files.

Login in

or Register

I forgot my password

Stats

26259 sites have been optimized using this service!

Updates

Version 0.486, Add support for dynamic html pages using PhantomJS

Version 0.353, Add blacklist to skip pages

Version 0.325, Support http authentication

Version 0.299, Improve javascript discovery

Version 0.277, Customize crawler user agent

Version 0.257, Explore style elements for css files

Version 0.253, Increase the number of pages explored

Version 0.241, Improve discovery of css files

Version 0.225, Fix bug affecting url resolution and javascript exploration

Version 0.216, Add css tidy integration, add date of last exploration

Version 0.200, Add file size difference chart and number of lines difference chart

Version 0.187, Update site interface and design

Version 0.155, Fix bug in CSS differences preview.

Version 0.152, Update CSS download interface.

Version 0.128, Improve preview panel CSS differences highlighting system

Version 0.105, Fix a bunch of encoding problem happening with Japanese sites.

Version 0.090, Add support for gzipped css file.

Version 0.080, Add asynchronous system for unused CSS sample.

Version 0.077, The site is pushed online.