CSS Minifier

Shorten a stylesheet on this page.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

The pass drops comments and collapses space. It does not rename classes.

A broken stylesheet can still come back shorter. This is not a full CSS parser.

How to use it

  1. Open this page and provide the input it asks for.
  2. Set the options that are visible, then use Minify CSS.
  3. Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.

Limitations

A character squeeze with no stylesheet model

Comments disappear and punctuation is pulled tight

Comments and spare spaces are stripped by a character pass. The minifier deletes every block comment, from the opening slash-star through the closing star-slash. It then collapses remaining whitespace to single spaces and removes spaces that sit beside a brace, a colon, a semicolon, or a comma. The result is trimmed. An empty box fails with a prompt to paste something. There is no indent control, because the goal is fewer characters.

This pass does not build a stylesheet model. Property names are not looked up. A selector is not checked. A value is not calculated. That is why it can be short, and why it can damage text a real parser would have protected. A block-comment marker that appears inside a string, with a later closing marker, can be eaten as if it were a comment. Runs of spaces inside a string collapse. The formatter’s scanner, which copies strings and comments before it indents, is the safer reader. This minifier is the shorter file.

What survives

A comment you needed, such as a copyright line or a source-map hint, is gone. A license header will not come back from the minified text. Original line breaks are gone. A custom property and a vendor-prefixed property are kept as characters, spaces aside. The page does not concatenate several files, and it does not rename classes. If a selector relied on a descendant combinator that was a space, a single space remains where whitespace remains between tokens that are not beside the tightened punctuation. Check a rule that used an unusual string before you replace the source.

Formatter versus this squeeze

The formatter rejects unbalanced braces and unclosed strings. This minifier does not. A broken stylesheet can come back shorter and still broken. Use it when the input is CSS you already trust and you want a compact line. Use the formatter when you want to see the structure. Neither page executes the stylesheet or applies it to a document.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.