Free CSS Minifier
Minify CSS by removing whitespace, comments, and redundant code. Reduce CSS file size for faster website performance. Free, with no sign-up required — everything happens right in your browser, so nothing you enter is sent to a server.
💻 CSS Minifier
How the CSS Minifier Works
Paste CSS and press Minify CSS. The tool protects strings and url() values first, then removes comments (except important ones that start with /*!), collapses runs of whitespace and deletes the spaces that are safe to remove: around braces, semicolons and commas, and after colons. The last semicolon in each block is removed, and the result shows the size saved.
Some spaces in CSS carry meaning, so they are kept. A space in a selector such as ul :first-child is a descendant combinator, and removing it would change which elements match. Spaces around + and - inside calc() are required by the specification. This minifier does not rename classes, merge rules, shorten colour values or reorder properties, so savings are typically 15 to 30% for hand-written CSS. A build tool such as cssnano can save more, and gzip or Brotli compression on your server adds a further large reduction.
Practical Use Cases
- Reduce the size of a stylesheet before uploading it to a website.
- Check how much of a CSS file is whitespace and comments.
- Prepare a small snippet or inline style for an email or embed.
- Compare the size of your CSS before and after minification.
Tips for Best Results
- Keep your source CSS and minify as part of publishing. Editing minified CSS by hand is slow and error-prone.
- Test pages that use descendant selectors, calc() and custom properties after replacing a stylesheet. The tool preserves their spaces, but a quick visual check costs little.
- Put licence notices in a comment that starts with /*! so they survive minification when your licence requires attribution.