What is CSS Minifier?
This CSS minifier shrinks stylesheets by removing everything browsers do not need: comments, line breaks, indentation, spaces around braces, colons, semicolons and commas, and the semicolon before each closing brace. The styles still work exactly the same, but the file is smaller and loads faster.
Paste your CSS and the minified version appears beside it with the before and after character counts and the percentage saved, ready to copy into a production stylesheet, an inline style block or an email template.
How to use CSS Minifier
- Paste your CSS into the Raw CSS Input box.
- The minified CSS appears in the output box instantly.
- Check the character count and percentage saved.
- Copy the minified CSS into your production files.
Key features
- Removes comments, whitespace and line breaks
- Strips spaces around braces, colons, semicolons and commas
- Drops redundant final semicolons
- Shows character counts and percentage saved
- Instant output as you type
- Runs entirely in your browser
Common use cases
- Shrinking stylesheets for faster page loads
- Minifying critical CSS inlined in the <head>
- Compressing CSS for HTML email templates
- Reducing the size of CSS embedded in JavaScript or JSON
- Quickly minifying CSS without a build tool
Technical details & standards
Minification removes /* … */ comments, collapses all whitespace, deletes spaces around {, }, :, ; and ,, and drops the final semicolon in each rule, all of which are optional in CSS syntax. Typical savings are 15–30% for hand-written, commented stylesheets.
It is a whitespace and comment minifier: it does not merge duplicate rules, shorten colors or remove unused selectors. Because it removes spaces before colons, a descendant selector written with a space before a pseudo-class, such as div :hover, is changed to div:hover; write such selectors as div *:hover. Serve the result with gzip or Brotli for the biggest reduction.
Frequently asked questions
Does minifying CSS change how my page looks?
No. Comments and most whitespace are optional in CSS, so the rules apply exactly as before. The one exception is a space before a pseudo-class in a descendant selector (div :hover); write it as div *:hover to keep its meaning.
How much smaller does minified CSS get?
Usually 15–30% for hand-written CSS with comments and indentation. Compressing the minified file with gzip or Brotli on the server typically saves far more.
Should I minify CSS in production?
Yes. Smaller CSS downloads faster and render-blocking CSS directly affects page load metrics such as First Contentful Paint. Build tools like Vite, webpack, Lightning CSS and cssnano do it automatically.
Can I un-minify CSS?
Formatting can be restored with a CSS beautifier or your editor's formatter, but comments removed during minification cannot be recovered, so keep the original source.
Is my data safe?
Processing happens locally in your browser. Tool input is not sent to CodeUnpack servers.
Does it work offline?
Once the page has loaded, this tool can process input without an internet connection.