This page removes characters from CSS without rewriting values. It collapses runs of whitespace, drops spaces around braces, semicolons, commas and combinators, removes comments if you ask it to, and can delete the last semicolon in each block. The result is smaller CSS that should behave the same as the input, and the stats show the before and after size.
It is a text minifier, not a compiler. It does not merge rules, shorten colours, rename custom properties or remove unused declarations. Those transformations need a parser and a test suite, because they can change behaviour. This page only takes out characters that valid CSS does not need, and it leaves the places where whitespace is load-bearing alone.
What it removes
Whitespace between tokens is collapsed to a single space where a space is still needed. Spaces around {, }, ; and , are removed, as are spaces around the child and sibling combinators >, + and ~. A space that separates two selectors, such as the descendant combinator, is kept. A space between two values, as in 1px solid #ddd, is also kept.
Comments are removed when the option is on. That includes licence headers and source-map hints. With the option off, each comment is copied exactly, including its internal spacing, so /* keep this spacing */ survives character for character. The surrounding CSS is still minified; the comment is not.
The last-semicolon option removes the semicolon before a closing brace. That is safe in CSS: the final declaration in a block does not need a terminating semicolon. If the option is off, the semicolon stays.
Where whitespace is preserved
CSS requires whitespace around + and - inside calc(), min(), max() and clamp(). Those functions are copied as whole units rather than run through the punctuation pass, so calc(50vh + 10px) and clamp(1rem, 2vw + 1rem, 3rem) come back exactly as written. Nested parentheses and commas inside them are handled the same way.
Quoted strings are preserved too. A content value containing braces, commas or repeated spaces is copied whole, so a label does not lose its text. url() is treated as a function and copied as written, including a quoted path with a space or a data URI with semicolons.
The protection is token-based: the tool finds the opening function or quote and copies through the matching close. It is not a full CSS parser, so an unclosed quote or an unusual vendor function is worth checking by eye. Everything outside those protected pieces is plain text and is minified normally.
A worked example
A 148-character stylesheet with a comment, a custom-property block and a card rule containing calc() and min() was reduced to 108 characters, a saving of 27%. The comment count was one.
| Input | Options | Result |
|---|---|---|
Four rules with calc(), 148 characters | Comments, last semicolon | 108 characters, 27% smaller |
| Comment kept, 47 characters | Neither option | 40 characters; comment spacing intact |
div > p + span ~ a, 43 characters | Comments | 28 characters; selectors joined |
Quoted content and url(), 65 characters | Comments | 55 characters; both values intact |
The first output removed the comment and the spaces around braces and colons, then joined the declarations. The calc(50vh + 10px) and min(10px, 20px) values came back unchanged, which is the part that used to break. The var(--gap) reference was left alone.
The kept-comment run is the check for the second fix: the comment still reads /* keep this spacing */ with all three spaces between the words. Only the rule around it was compacted. The selector run shows the normal behaviour outside protected pieces, where div > p + span ~ a becomes div>p+span~a without changing what it selects.
Comments, licences and source maps
Removing comments is often the biggest saving in a documented stylesheet, and it is also the riskiest. A licence that requires its notice to remain in the distributed file should not be stripped. Some build tools preserve comments that start with /*!; this page does not make that distinction, so turn the option off or add the notice back if your licence needs it.
A source-map comment such as /*# sourceMappingURL=app.css.map */ is also removed when comments are on. If you minify a file that has a map, the map will no longer point at the right place after the text changes. Regenerate the map from the build, not from this output.
Checking the result
Paste the output back into the CSS beautifier and compare the rules with the original. That will not prove equivalence, but it makes the structure visible and helps spot a missing brace or a broken value. For anything important, load the page and check the affected component in a browser.
Keep the original file. Minification is one-way in practice: the output is harder to edit and the comments are gone. The code diff checker can compare the original and the minified text if you need a record of what changed, though most of the differences will be whitespace.