CSS Minifier
Minify CSS online: strip comments, whitespace and redundant semicolons to shrink your stylesheet, and see the bytes saved. Runs in your browser.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the CSS Minifier
The CSS Minifier removes comments, whitespace and redundant characters from stylesheets to cut download size without changing how pages look.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the CSS Minifier
- Paste CSS or open a file.
- Compare the original and minified size.
- Copy or download the minified CSS.
Example
Input
/* Primary button */
.btn-primary {
color: #ffffff;
background-color: #2563eb;
padding: 8px 16px;
}
.btn-primary:hover {
background-color: #1d4ed8;
}Result
.btn-primary{color:#ffffff;background-color:#2563eb;padding:8px 16px}.btn-primary:hover{background-color:#1d4ed8}158 bytes become 113 (about 28% smaller). The comment, line breaks and the semicolon before each } are removed; the space in "8px 16px" stays because it separates two values.
Common mistakes
- Editing the minified file. Keep the readable stylesheet as your source and minify it as a build step. Changes made to minified CSS are hard to review and easy to lose.
- Spaces in calc(). calc(100% - 32px) needs the spaces around - and +. The minifier keeps them, so do not remove them by hand afterwards.
- Comments you need. All comments are removed, including licence headers. Add required licence notices back at the top of the minified file.
Works well with the CSS Minifier
- CSS Formatter: expand minified CSS back into readable code.
- HTML Minifier: shrink the HTML that loads the stylesheet.
- CSS Gradient Generator: create gradient backgrounds to add to the stylesheet.
Frequently asked questions
Will minified CSS behave differently?
No. Only characters that do not affect the rules are removed.
Should I keep the original?
Yes. Edit the readable version and minify it again for production; minified CSS is hard to maintain.
How much smaller will my CSS get?
Typically 15 to 30 percent, depending on how many comments and how much indentation the file has. The tool shows the exact size before and after.
Is minifying the same as gzip?
No, they add up. Minify first, then let your server compress the file with gzip or Brotli for the smallest download.
Guides and tutorials
Related tools
JSON Minifier
Minify JSON online by removing all unnecessary whitespace, and see how many bytes you saved. Invalid JSON is reported with its line and column.
HTML Minifier
Minify HTML online: remove comments and collapse whitespace while keeping pre, textarea, script and style blocks intact. See the size saved instantly.
JavaScript Minifier
Minify and mangle JavaScript online with Terser for smaller bundles. Supports modern ES syntax, with compress and mangle options and the size saved.
XML Minifier
Minify XML online by removing whitespace between tags, with an option to keep comments. Malformed XML is reported with its location.
SQL Minifier
Compress SQL queries onto a single line online, removing comments and redundant whitespace. Useful for logs, config files and embedding SQL in code.
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.