Overview
cssnano is a CSS minifier. It takes the readable stylesheet you write and produces a smaller version for production that behaves the same in the browser. It is not a website you paste code into day to day; it is a set of PostCSS plugins that you add to your build process so that minification happens automatically every time the site is built.
Rather than only stripping whitespace and comments, cssnano applies around thirty separate optimisations. Examples include normalising selectors, shortening colour and shorthand values, removing duplicate properties and dropping definitions that have no effect. Which optimisations run is controlled by a preset. The default preset sticks to changes that are meant to be safe for any stylesheet, while the advanced preset compresses harder using techniques that make more assumptions about your CSS. You can also adjust or switch off individual optimisations in the configuration.
The project is open source under the MIT licence and is funded through donations on Open Collective. The website has documentation for each optimisation and an online playground for seeing what the minifier does to a snippet. It is for front-end developers who already use, or are willing to set up, a PostCSS-based build.
Categories
Features
- Minifies CSS as a PostCSS plugin in a build pipeline
- Around thirty individual optimisations
- Default preset limited to safe transformations
- Advanced preset with more aggressive compression
- Individual optimisations can be configured or turned off
- Online playground for trying snippets
- Documentation page for each optimisation
Privacy
See the official privacy policy. cssnano runs locally as part of your own build, and no ad or analytics scripts were found on the project site.
Pros & Cons
Pros
- Open source under the MIT licence
- Goes beyond whitespace removal to restructure values and rules
- Safe defaults, with harder compression available when wanted
- No account, sign-up or ads
Cons
- Needs a PostCSS build setup, so it is not a paste-and-go tool
- The advanced preset can change behaviour if its assumptions do not hold for your CSS
- Configuration is done in code or config files, not a graphical interface
Community Reviews (0)
No written reviews yet — be the first to rate this tool.
Similar Tools
-
CSS · W3C Validators
Checks CSS for errors and standards compliance.
Open Source No Signup Web API -
CSS · CSS-Tricks
Provides tips, tricks, and reference guides for CSS.
Free No Signup Web -
Removes unused CSS from a project to reduce file size.
Open Source No Signup Web