CSS Minifier / Beautifier
Minify or beautify CSS stylesheets.
CSS
Output
About the CSS Minifier / Beautifier
The CSS Minifier and Beautifier does two opposite jobs on the same stylesheet. Minify strips comments, newlines and unnecessary spaces to shrink the file; beautify re-indents it so a human can read it again.
Minifying matters because CSS blocks rendering: the browser cannot paint until it has the stylesheet, so a smaller file arrives sooner. Removing comments and whitespace typically saves 20 to 40 per cent on hand-written CSS, and much more if the file is heavily commented.
Beautifying is the reverse, and it is what you reach for when debugging a theme someone else minified. It only changes whitespace and layout, never the rules themselves, so a selector that did not match before will not match afterwards either.
Common questions about CSS Minifier & Beautifier
What does minifying actually remove?
Comments, line breaks, and redundant spaces around selectors, properties and braces. The rules themselves are untouched.
Is minifying safe?
For ordinary CSS, yes. Check anything unusual afterwards, especially long data URIs or strings containing spaces.
How much smaller will my file get?
Typically 20 to 40 per cent for hand-written CSS. Already-minified files barely change.
Can I beautify minified CSS back?
Yes, and it is readable again, though comments removed by minification are gone for good.
Does it change how the page looks?
No. Whitespace outside strings has no effect on rendering.
Should I minify for production only?
Yes. Keep the readable source in version control and minify as a build step.