Skip to content

CSS Minifier

Compresses a CSS string or file with no possible side-effect: strips comments and whitespace and removes the last semicolon of blocks.

Loading tool...

About the CSS minifier

Minifying a stylesheet removes everything that is only there for humans and rewrites values in their shortest equivalent form. The result renders exactly like the original but is smaller.

Rules applied

  • Remove whitespace, indentation and line breaks.
  • Strip comments (optionally keeping /*! ... */ comments).
  • Remove the last semicolon of a block and empty rule sets.
  • Remove the unit of zero lengths.
  • Remove leading zero of decimals and trailing zeros.
  • Convert rgb() with integer components to hexadecimal.
  • Shorten six-digit hex colors when possible.
  • Replace none by 0 for border and outline.
  • Collapse repeated shorthand values.
  • Normalize ! important.

What is left untouched

  • Content of strings and url() is copied byte-for-byte.
  • Spaces inside calc(), min(), max() and clamp() are kept.
  • Custom properties (--name) keep their case.
  • Declarations are never reordered or deduplicated.
---