CSS Minifier
Paste your stylesheet. Get a compact, production-ready version back — comments stripped, whitespace collapsed, required spaces kept.
Everything stays in your browser. Nothing is uploaded or stored.
How to minify CSS
Minification is the last step before a stylesheet ships: it removes everything humans need (comments, indentation, line breaks) and keeps everything browsers need. Paste, minify, and serve the small file.
- Paste your CSS into the box above.
- Hit Minify CSS. The stats show exactly how many bytes you saved.
- Copy or download the result and use it as your production stylesheet — keep the readable original for future edits.
What gets removed — and what is protected
Removed: comments, extra whitespace, the last semicolon inside each { … } block, spaces around { } : ; , and around the > + ~ combinators. Protected: quoted strings (so content: "/* not a comment */" survives), url(…) contents, and the insides of calc(), min(), max(), and clamp() — because calc(100% - 20px) breaks if its spaces are stripped.
- What does a CSS minifier do?
- It shrinks your stylesheet by removing comments, collapsing extra whitespace, and dropping unnecessary characters — turning human-readable CSS into a compact file that browsers download faster. Your styles behave exactly the same.
- Is it safe? Will my styles still work?
- Yes. The minifier only removes characters that never change meaning: comments, redundant whitespace, and the last semicolon in a block. Spaces that matter — like the one in margin: 0 auto or inside calc(100% - 20px) — are preserved.
- Why does minifying matter for page speed?
- Smaller stylesheets download faster, especially on slow mobile connections. Minified CSS also compresses better with gzip and Brotli, so your real-world savings are even bigger than the byte count shown.
- What about calc() and other functions?
- Expressions like calc(100% - 20px) require spaces around the minus sign, so the minifier treats calc(), min(), max(), and clamp() as protected zones and never touches the spacing inside them.
- Can I minify invalid or broken CSS?
- The tool does its best with whatever you paste — it works on text patterns, not a full parser, so it never crashes. But always check your site after pasting, since broken input can produce broken output.
Kept alive by readers like you
Every tool in the codex is free. If they save you time, a small donation inscribes new pages.
DonateMore from the codex
CSS Minifier
Shrink stylesheets safely — calc() aware.
JSON Formatter
Validate, format, and minify JSON.
Open tool → LiveBase64 Encoder
Encode and decode Base64, URL-safe too.
Open tool → LiveURL Encoder / Decoder
Encode/decode URLs and parse query strings.
Open tool → LiveColor Picker
Hex/RGB/HSL converter, palettes, contrast checker.
Open tool → LiveRegex Tester
Test regular expressions with live match highlighting.
Open tool → LiveMarkdown Previewer
Live markdown preview with instant HTML rendering.
Open tool → LiveImage Compressor
Shrink images in your browser — JPEG, WebP, PNG.
Open tool → LiveWord Counter
Count words and estimate reading time instantly.
Open tool →