What this tool does
CSS Minifier first parses CSS into a syntax tree, and then cleans, compresses and optimizes the structure. It doesn't do dangerous whitespace regex replacement of the entire file, so it can distinguish between selectors, declarations, strings, and function contexts.
- /*! comments in the license form are retained.
- Supports modern selectors, media queries, calc() and custom attributes.
- Parsing errors are displayed, old error results are not output.
How to use it
- Paste the CSS.
- Click "Compress CSS."
- View compression results and savings ratio.
- Copy or download minified.css and perform visual regression testing.
Common uses
- Optimize the size of the production environment style sheet.
- Remove meaningless whitespace and plain comments.
- Consolidate declarations and values that are safe to optimize.
CSS Minifier Features
Compress CSS using CSSO syntax trees, understanding string, calc and custom property context. It is suitable for daily development, debugging, data sorting and code optimization scenarios. The processing results can be directly viewed, copied or downloaded.
FAQ
What optimizations will CSSO do?
It cleans up redundancy, shortens values that can be expressed in shorter forms, and restructures some declarations under safety rules.
Will custom attributes be preserved?
Yes. CSS custom properties are handled by the parser, though you should still test the final stylesheet in your target browsers for complex projects.
Why keep /*! comments?
This type of comment is often used for license or copyright notices, and the current configuration is selected to be retained.