ToolLineup

CSS Minifier

This CSS minifier strips comments, collapses whitespace, removes the spaces around braces, colons, semicolons and combinators, and drops the optional final semicolon before each closing brace. Quoted strings and url() values are lifted out before any whitespace rule runs and restored untouched — without that step a font family called Helvetica Neue or a path containing spaces would be silently corrupted, which is the classic failure of naive regex-based minifiers. Comments beginning with an exclamation mark are kept, the convention for licence headers.

How it works

Strips comments, collapses whitespace, removes the spaces around braces, colons, semicolons and combinators, and drops the final semicolon before each closing brace.

Strings and url() values are lifted out first and restored untouched, so a font name or a file path containing spaces survives intact. Comments beginning /*! are kept, which is the convention for licence headers.

Everything runs in your browser — nothing you paste is sent to a server.

CSS input
Paste CSS here…
Minified CSS

How to minify CSS

  1. Paste your stylesheet into the input on the left.
  2. Choose whether to strip comments.
  3. Copy or download the minified sheet, with the saving shown below.

What is removed

  • Comments, except those beginning /*!, the convention for licence headers.
  • All redundant whitespace, including around braces, colons, semicolons and combinators.
  • The final semicolon before each closing brace, which is optional.

Strings and URLs are protected

Quoted strings and url() values are lifted out before any whitespace rule runs and put back untouched. Without that step, a font family called "Helvetica Neue" or a path containing spaces would be silently corrupted — which is the classic failure of naive regex-based minifiers.

Common use cases

  • Inlining critical CSS into the head of a page.
  • Shrinking a stylesheet embedded in an email or an exported document.
  • Checking how much a sheet would compress before wiring up a build step.

Frequently asked questions

Are font names with spaces safe?

Yes. Quoted strings and url() values are lifted out before any whitespace rule runs and put back untouched, so a family like "Helvetica Neue" survives intact — this is exactly where naive regex minifiers corrupt a sheet.

Are licence comments preserved?

Yes. A comment beginning with an exclamation mark is kept, which is the long-standing convention for marking a header that must not be stripped.

Does it rewrite my colours or shorthand?

No. Only whitespace and comments are removed. Values are left exactly as written, so the minified sheet renders identically.

How much smaller does CSS get?

Typically 15 to 35 percent for a hand-written sheet, more when it carries a lot of comments. The exact saving is shown under the output.

Is my code uploaded anywhere?

No. Everything runs entirely in your browser, so nothing you paste is transmitted or stored on a server.

Related tools