Code tool
CSS Minifier and Beautifier
Minify CSS for production, or beautify a minified stylesheet so you can read it again.
Runs entirely in your browser. Nothing you paste is uploaded.
Paste some CSS to get started.
How to use the CSS Minifier
- Paste your CSS into the left box.
- Select Minify to compress it, or Beautify to add line breaks and indentation.
- Check how much was saved, then copy the result or download it as a .css file.
What a CSS minifier removes, and what it keeps
A CSS minifier compresses a stylesheet by removing everything a browser does not need. A CSS beautifier does the opposite and turns minified CSS back to normal, readable code. This online tool does both.
Minifying deletes the parts of a stylesheet that only people need: comments, line breaks, indentation, spaces around braces and colons, and the final semicolon in each rule. Browsers read the result exactly the same way, and a smaller file reaches them sooner.
This minifier is deliberately conservative. It does not rename, merge or reorder rules, and it leaves values alone, so calc(100% - 2rem), custom properties, quoted strings and url() data URIs come through intact. It is tested against real stylesheets to confirm that browsers read the minified result as exactly the same rules.
Smaller CSS helps Core Web Vitals because stylesheets block rendering. For the biggest gains, combine minification with compression on your server (Brotli or gzip) and remove rules your pages never use.
Common questions
How do I minify CSS online?
Paste the stylesheet and choose Minify. Copy the compressed CSS and use it in place of the original file.
Will minifying change how my site looks?
No. Only whitespace and comments are removed, so browsers apply exactly the same rules.
How much smaller will my CSS get?
Hand-written CSS usually shrinks by 15 to 30 percent. Heavily commented files save more.
Can I get readable CSS back from a minified file?
Yes. Paste it and choose Beautify. Comments that were removed cannot be restored.
Is my CSS uploaded?
No. Everything runs locally in your browser.
Guides for the CSS Minifier
- How to Minify CSS (and When to Beautify It Back)Minifying CSS removes comments and whitespace so stylesheets load faster. What it changes, how much it saves, and how to minify or beautify online.
- How to Minify JavaScript: What Minification Does and WhyMinifying JavaScript removes whitespace and dead code and shortens names, so scripts download and parse faster. How it works and how to do it.
- How to Format and Minify HTML (Without Breaking the Page)Format HTML so it is readable, or minify it so the page is lighter. Which whitespace matters, what a safe minifier removes, and how to do both.
- How to Run HTML, CSS and JavaScript Online (Free HTML Compiler)Run HTML, CSS and JavaScript online without installing anything. How an HTML compiler works, how to read console errors, and when to use one.