About this CSS compressor
Every byte of CSS has to be downloaded before a page can be drawn, so production sites ship minified stylesheets. This compressor parses your CSS and writes it back with nothing a browser does not need. Standard mode removes comments, line breaks, indentation, spaces around symbols, and the last semicolon in each rule. Aggressive mode also rewrites values: #ffffff becomes #fff, 0px becomes 0, 0.5 becomes .5, bold becomes 700, and empty rules are dropped. Preserve lines mode keeps each rule on its own line, which makes compressed files easier to compare in version control.
How to compress CSS
- Add your CSS. Paste CSS, press Open a CSS file, or press an example.
- Choose a mode. Pick Standard for safe minification, Aggressive for the smallest file, or Preserve lines for readable diffs.
- Press Compress CSS. The compressed code appears with the percentage saved, bytes before and after, and counts of removed lines and comments.
- Copy or download. Press Copy CSS, or Download to save it as styles.min.css.
Frequently asked questions
Is aggressive mode safe?
Its changes do not alter how browsers render the CSS: short hex colors, unitless zeros, and numeric font weights mean exactly the same thing. Percent values such as 0% are left alone, because in some properties they are not equal to 0.
Why is the /*! comment kept?
Comments that start with /*! conventionally hold licence or copyright notices that must stay in distributed files. Every other comment is removed in all three modes.
How much smaller will my CSS get?
Hand-written CSS with comments and indentation usually shrinks by 20 to 40 percent. A file that is already minified saves little, and gzip or Brotli compression on the server reduces the transfer size further.
Can I turn compressed CSS back into readable code?
Yes. Paste it into the CSS Beautifier to restore indentation and line breaks. Removed comments cannot be recovered, so keep your original source file.