CSS Minifier

Minify CSS by removing comments and unnecessary whitespace with a simple minifier.

Try an example

Load a ready-made sample into this tool and run it. Every result you see is calculated live by the tool itself — nothing here is a pre-written answer.

Sample: input: /* Comment */ body { margin: 0; padding: 0;...

How to Use

  1. Paste CSS code.
  2. Click Run.
  3. Copy the smaller CSS.

What this CSS minifier does

This CSS minifier shrinks stylesheet code by removing comments and unnecessary whitespace, producing a compact version that is smaller to store and send. Paste your CSS, run the tool, and copy the minified result for use in a project. The rules and values in your stylesheet stay the same; only the spacing and comments around them are stripped away in the process.

When minified CSS is useful

Smaller CSS files download faster, which is why production websites usually serve minified stylesheets. Minify a copy before publishing a site, sending a file to a client, or embedding styles where space is tight. Keep your original, readable version for editing, since minified code is awkward to work through later.

Good to know

This is a simple minifier: it strips comments and collapses whitespace but does not parse or optimize your selectors. It will not merge rules, shorten values or catch errors, so check the minified output in a browser before relying on it.

Frequently asked questions

Does minifying change how my CSS works?

It should not change behavior. The tool removes comments and extra whitespace only, leaving selectors, properties and values untouched. Still, preview the minified file once before publishing, as you would with any change.

Why does the tool leave my selectors alone?

Optimizing selectors means understanding what each rule matches, and this simple minifier does not parse your CSS that deeply. It sticks to safe, mechanical savings: comments and whitespace, which never affect how styles apply.

Should I keep my original stylesheet?

Yes. Minified CSS is hard to read and edit, so keep the formatted original as your working copy and treat the minified output as a publishing copy you regenerate whenever the original changes.

How to use CSS Minifier

  1. Paste CSS code.
  2. Click Run.
  3. Copy the smaller CSS.

Limitations

This is a simple minifier: it strips comments and collapses whitespace but does not parse or optimise selectors.

Browse all tools · More Developer Tools tools

Scroll to Top