CSS Minifier
Paste a stylesheet to remove layout whitespace and ordinary standalone comments. Spaces that carry meaning, such as the descendant selector in .card .title, are kept, along with license and source-map comments. Everything runs in your browser and your input stays on this device.
What this tool does
Remove removable layout whitespace and ordinary standalone comments from parsed CSS.
What does CSS minification remove?
It removes layout whitespace and ordinary standalone comments. It keeps spaces that change meaning, text inside strings, license comments and source-map comments. It does not remove unused rules. Server-side compression such as gzip or Brotli is a separate step.
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.
- What is the difference between minifying and compressing CSS?
- Minifying rewrites the stylesheet with less whitespace. Compression such as gzip or Brotli is applied by your server when it sends the file. They work together.
- Will minifying change how my CSS behaves?
- The tool is built to keep selector and value syntax intact, including meaningful spaces such as the one in .card .title. Test a small page that uses the rules you changed.
- Is my CSS uploaded anywhere?
- No. It is processed in your browser and stays on your device.