TextyConverterbeta
⌘K

CSS Minifier

Strip comments and whitespace from CSS to shrink your stylesheet. Browser-only, free.

0 characters
0 characters

About CSS Minifier

The CSS minifier removes comments, collapses whitespace, and drops the optional final semicolon in each rule to produce a smaller stylesheet that renders identically. Real-world CSS minification can also rewrite property values (#ffffff → #fff, 0px → 0), but this tool keeps it simple and safe — only whitespace and comments are touched.

When to use it

  • Reducing CSS payload before HTTP compression
  • Inlining a stylesheet into a single attribute or template
  • Stripping authoring comments before publishing
  • Producing a more compact CSS string for a CSS-in-JS escape hatch

How it works

A regex pass removes /* ... */ comments. A second pass collapses runs of whitespace inside the document into single spaces and removes whitespace around braces, colons, semicolons, and commas where it isn't significant.

Examples

Comments removed, whitespace collapsed
/* main button */
.button {
  background: #ffffff;
  color: #000000;
  padding: 0.5em 1em;
}
.button{background:#ffffff;color:#000000;padding:0.5em 1em}

Frequently asked questions

Will my page render the same?
Yes. Comments and whitespace are not significant in CSS. The cascade and specificity rules apply identically to the minified output.
Does it rewrite values like colors or zero units?
No. To keep the tool simple and safe, value-level optimizations (#ffffff → #fff, 0px → 0, removing duplicate rules) are not performed. For aggressive minification, use a real CSS minifier like cssnano or lightningcss in your build.
What about CSS comments inside strings?
Strings inside content: properties are scanned and preserved, but the simple regex pass may produce incorrect output for unusual cases. Verify the result before shipping.
Is the file uploaded?
No. Minification runs entirely in your browser.

Related tools