Skip to content

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.

Frequently Asked Questions

Typically 15 to 30% for CSS with comments and indentation. Already compact files shrink less.
Yes. This tool only removes comments and whitespace that have no effect, and keeps spaces that matter, such as descendant selectors and spaces inside calc(). Test your site after replacing a stylesheet anyway.
Comments that start with /*! are treated as important and kept. All other comments are removed.
Yes. Minification and server compression work together. Gzip or Brotli usually shrinks text files by a further 60 to 80%.
No. The processing runs in your browser.