Frontend Tools
Online CSS Minifier
Minify CSS in your browser: remove comments and whitespace, keep strings, url() values and licence comments, compare byte sizes and download styles.min.css.
How to use Online CSS Minifier
Paste CSS on the left and the minified code and size comparison appear on the right as you type. Licence comments that start with /*! are kept unless you untick the option. Copy the result or download styles.min.css when you are happy with it.
- Paste your CSSPaste a stylesheet, including comments, media queries and nested rules.
- Check the savingsThe note above the code shows the original and minified sizes in bytes, and warns about unbalanced braces.
- Copy or downloadCopy the minified CSS or download styles.min.css, and test it in your project before you deploy.
What is removed and what is kept
The minifier follows the structure of the CSS. It removes ordinary comments, the whitespace around selectors, colons, semicolons, commas, braces and the >, + and ~ combinators, and the last semicolon in each rule. Strings, url() values and the spaces calc() needs around + and - are left alone, and the descendant space in a selector such as div :first-child is kept. The sample shrinks from 328 to 260 bytes, a saving of 68 bytes or 20.7%.
Before you replace your stylesheet
This is safe text minification: it does not merge rules, reorder declarations, remove unused selectors or rewrite colours and numbers. Sizes are counted in UTF-8 bytes, which reflects the real file size better than character counts when the CSS contains non-ASCII text. Keep the readable source under version control, publish the minified file as a build output, and check layouts, hover and focus states and breakpoints after swapping it in.
Accuracy and data handling
After adding generated code to a project, test it in the target browsers and responsive sizes. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
What does the CSS minifier remove?
Ordinary comments, line breaks, unnecessary spaces and the final semicolon in each rule. Comments starting with /*! are kept for licences unless you untick that option.
Can minifying break my CSS?
It only removes whitespace that CSS ignores and never touches strings or url() values. Source that already has syntax errors may behave differently, and the tool warns when the braces do not balance.
Does it merge rules or remove unused CSS?
No. It performs conservative minification and a size comparison only. Use a build tool if you need rule merging or unused-style removal.
Is my CSS uploaded?
No. Minifying, counting bytes and creating the download all happen in your browser.
More Frontend Tools
Related toolsShrink HTML by removing comments and spare whitespace, with the byte saving shown.
Strip comments and whitespace from JavaScript safely, with the size saving shown.
Indent messy or minified HTML into readable, nested lines, including inline CSS and JS.
Reformat compressed JavaScript into indented, readable code without touching strings.
Convert between px, rem, em, % and pt using your own root and parent font sizes.
Build fluid clamp() font sizes and spacing that scale between two viewport widths.