CSS Minifier
Compact a stylesheet while preserving selector and value syntax and license comments.
Runs in your browser. Your input stays on this device.
What this tool does
Remove removable layout whitespace and ordinary standalone comments from parsed CSS.
When to use it
Generate a compact fixture or distribution artifact while keeping the editable stylesheet readable.
How to use it
- Paste a valid stylesheet.
- Choose Minify CSS, then inspect the result for meaningful spaces and preserved comments.
- Download the compact revision and compare it in a representative page.
Worked example
Load the sample with a card rule and a media query. Minify it and compare the result with the original. You should see fewer spaces and line breaks while each declaration remains inside its original rule. To check an edge case, add content: "two words" to a pseudo-element rule and verify that it still contains the space inside the quotes. In a project, keep the readable stylesheet as your source and use the compact output as the artifact you publish or compare in a size test.
.card .title {
margin: calc(100% - 1rem);
}.card .title{margin:calc(100% - 1rem)}Supported features and limitations
This is whitespace minification. It preserves selector and value text where spacing can be significant. License and source-map comments are kept.
Common mistakes and edge cases
Spaces can carry meaning between selectors and within values. For example, .card .title selects a descendant, while .card.title requires both classes on the same element. Expressions such as calc(100% - 1rem) also have spacing rules. Inspect custom properties, strings and unfamiliar selectors after minifying. Stripping whitespace gives a different size reduction than separately enabling HTTP compression on the deployed site. Before publishing minified CSS, test a small page that exercises the selectors and properties you changed. Check responsive rules at both sides of a breakpoint and confirm that any source map still matches the published asset.
Frequently asked questions
- Does it remove unused selectors?
- The tool compacts existing CSS and does not know which selectors your application uses. Check usage across routes, responsive breakpoints and interactive states before deleting style rules from a project.
- Which comments should I expect to keep?
- License comments and source-map comments are preserved. If you publish a minified file with a source-map reference, verify that it points to the correct map for that generated file.