About this tool
Compress, minify, and shrink messy CSS code to reduce bundle size, showing detailed savings statistics.
The CSS Minifier compresses a stylesheet by stripping comments, collapsing every run of whitespace to a single space, removing the spaces around braces, semicolons and commas, and dropping the final semicolon before each closing brace. It then reports the original size, the minified size, the bytes saved and the percentage saved to one decimal place, all measured on the real UTF-8 byte length. A toggle keeps /*! banner comments intact so licence headers survive compression.
Open CSS Minifier on AltFTool — it loads instantly in your browser.
Paste your stylesheet into the Paste CSS Stylesheet box, or click Load Sample CSS to drop in a demo stylesheet that carries a /*! licence banner. As soon as the box has text a Compression Options panel appears, holding one toggle that reads Preserve important license comments (/*! ... */); click it to flip to Discard all comments.
Click Minify CSS Code. A green status line reads CSS minified successfully! and four cards report Original Size, Minified Size, Bytes Saved and Savings Ratio, the last as a percentage to one decimal place; running it on an empty box shows Please paste stylesheet code to execute compression instead.
Read the compressed stylesheet in the Minified CSS Code panel, then press Copy Code — its label flips to Copied! for 2 seconds — or Download (.min.css) to save the file as styles.min.css. Clear Input empties both boxes after a confirmation prompt.
Comments opened with /*! are set aside before stripping and restored afterwards, the same convention build tools use to keep legal headers in minified output.
Sizes are measured as encoded bytes rather than character counts, so the saving reported is the saving your server actually transfers.
It only removes whitespace and comments — selectors, property names, values and rule order are left exactly as written, so nothing can be renamed out from under you.
For hand-formatted stylesheets the saving is typically in the 10-30% range, and the tool reports your exact figure to one decimal place alongside the byte counts. Heavily commented files save more; files that are already compact save very little.
No. Only comments and insignificant whitespace are removed, plus the redundant semicolon before a closing brace, which CSS treats as optional. Selectors, properties, values, specificity and source order are untouched.
Write it as an important comment — open it with /*! instead of /* — and leave the preserve-comments option on. Those blocks are pulled out before the strip pass and put back afterwards; every ordinary /* ... */ comment is removed.
No — it is a whitespace and comment minifier only, so #ffffff stays #ffffff and two rules with the same selector stay separate. For structural optimisation like colour shortening, longhand collapsing or dead-rule removal you need a full optimiser such as cssnano.