CSS Minifier

Data Stays on Your Device

Minify your CSS code by removing whitespace, comments, and unnecessary characters.

Input CSS
Loading...
Minified CSS
Loading...

What is the CSS Minifier?

The CSS Minifier strips comments, whitespace, and other non-essential characters from a stylesheet to reduce its size, and can expand minified CSS back into a readable, indented form.

CSS is whitespace-insensitive between tokens, so the newlines and indentation that make a stylesheet readable contribute nothing to how it is interpreted. Removing them yields a smaller file that renders identically.

Typical savings are between 10% and 30% before compression. Because stylesheets are render-blocking, the browser will not paint until CSS has loaded and parsed, reducing their size has a direct effect on how quickly a page becomes visible.

Minification is safe precisely because it only removes characters the parser ignores. It does not rename classes, reorder declarations, or merge rules, so the cascade is unaffected.

How to use the CSS Minifier

  1. Paste your CSS. Drop in a full stylesheet or a fragment.
  2. Click Minify. Comments and insignificant whitespace are removed, producing a compact stylesheet.
  3. Or click Beautify. This reverses the process, restoring line breaks and indentation so a minified file becomes readable.
  4. Check the size reduction. The before and after sizes show how much you saved.

Worked examples

Minifying a rule set

Comments, newlines, indentation, and the final semicolon before a closing brace can all be removed safely.

Input
/* Card component */
.card {
  display: flex;
  padding: 16px;
  border-radius: 8px;
}
Output
.card{display:flex;padding:16px;border-radius:8px}

84 bytes reduced to 49, about a 42% saving on this fragment.

Expanding minified CSS

Beautifying is the inverse, which is how you make a vendor's minified stylesheet readable enough to modify.

Input
.btn{color:#fff;background:#06c}.btn:hover{background:#05a}
Output
.btn {
  color: #fff;
  background: #06c;
}
.btn:hover {
  background: #05a;
}

Common use cases

  • Reducing page weight. Smaller render-blocking stylesheets mean the browser can paint sooner.
  • Preparing CSS for inlining. Critical CSS inlined into the head should be minified, since it is transmitted with every HTML response.
  • Reading a third-party stylesheet. Beautifying a minified library stylesheet is the only practical way to understand or override it.
  • Sites without a build pipeline. Where there is no bundler, minifying by hand before upload is a straightforward optimisation.

Features and limitations

  • Minifies and beautifies from the same interface.
  • Removes comments, redundant whitespace, and the trailing semicolon before a closing brace.
  • Preserves the order of declarations, so the cascade is unchanged.
  • Keeps strings and url() values intact, including any whitespace inside them.
  • It does not rename selectors, merge duplicate rules, or remove unused CSS, those require a build tool that can see your markup.

Frequently asked questions

Does minifying change how my styles apply?

No. Only characters the CSS parser ignores are removed, so the resulting stylesheet is functionally identical. Declaration order and specificity are untouched.

How much smaller will my file get?

Typically 10% to 30%, depending on how heavily commented and indented the source is. Note that gzip and Brotli already compress repeated whitespace well, so the additional saving on the wire is smaller than the raw byte difference suggests.

Should I keep the unminified source?

Yes. Always edit the readable version and minify as a final step. Editing minified CSS directly is error-prone and loses your comments permanently.

Does it remove unused CSS?

No. Identifying unused rules requires analysing your HTML and JavaScript, which a standalone minifier cannot see. Tools such as PurgeCSS handle that as part of a build.

Will it preserve CSS custom properties?

Yes. Custom property declarations and var() references are preserved, as are media queries, keyframes, and nested at-rules.

Is my stylesheet uploaded?

No. Everything runs in your browser, so unreleased styles stay on your machine.

All processing happens locally in your browser, your data never leaves your device.