CSS Minifier & Beautifier
Two directions, one tool: minify a stylesheet for production — comments gone, whitespace collapsed, the last semicolon dropped — or expand someone's compressed CSS back into one declaration per line. Strings and url() values are shielded first, so nothing inside them is ever touched.
What minification removes — and what it must not
CSS ignores almost all whitespace, which makes it the easiest language on the web to compress by hand rules: strip comments, collapse runs of spaces, drop the space around braces, colons and commas, and remove the final semicolon before each closing brace. Every byte of that is guaranteed no-op by the grammar.
The exceptions are quoted strings and url() — there, whitespace is data. A minifier that does not shield them corrupts content properties and data URIs silently. This one jails them behind placeholders before the first regex runs and releases them after the last.
Frequently asked questions
How much does minification actually save?
Hand-written CSS typically shrinks 15–30%: comments, indentation and the space around braces and colons are pure air. The counter under the result shows honest bytes, measured as UTF-8, so you can decide whether the saving is worth losing readability in production.
Can it break my stylesheet?
The dangerous places are strings and url() values — a font name with two spaces, an SVG data URI with meaningful whitespace. Those are cut out and shielded before any whitespace rule runs, then restored verbatim. Everything else in CSS is whitespace-insensitive by specification.
Is beautify a real un-minifier?
Yes, structurally: every rule gets its braces spaced, every declaration its own indented line, selector lists break at commas. What it cannot restore is what minification destroyed forever — your comments and your blank-line groupings are simply gone from the input.
Should I still minify if my server uses gzip?
Yes, they stack: gzip compresses the minified file further, and the combination beats either alone. Minification removes what compression must otherwise model — a 100 KB sheet minified to 75 KB typically gzips several kilobytes smaller than the original would.
Related tools
- Diagram & Flowchart MakerDraw flowcharts and diagrams, connect the boxes with arrows that route themselves, and let it arrange the whole thing. Exports SVG. Nothing is uploaded.
- Password GeneratorGenerate strong random passwords using your browser's cryptographic RNG, with a live strength estimate.
- HTML Entity EncoderEncode text for HTML or decode entities back — the five markup breakers, named Latin-1 and symbol sets, numeric references up to emoji. Decodes exactly once.