Naar de hoofdinhoud
Tools Star Hub

CSS-minifier

Minificeer CSS in je browser met behoud van strings, URL’s, belangrijke opmerkingen en betekenisvolle spaties.

Tool laden…

Deze tool werkt in je browser. Invoer, bestanden en gegenereerde waarden blijven op dit apparaat. Favorieten en recent gebruikte tools bewaren, als je ze gebruikt, alleen toolnamen in de lokale opslag — nooit wachtwoorden, documenten of QR-inhoud. Lees het privacybeleid.

De uitgebreide handleiding voor deze tool (gebruik, voorbeelden en veelgestelde vragen) is voorlopig in het Engels.

What this tool does

Drop CSS comments and spare spaces between tokens. Front-end work that ships a stylesheet can use it for a shorter file before a build step. Selectors are not merged, spaces inside strings and calc() stay, and vendor prefixes are not added.

How to use

  1. Paste CSS into the left box.
  2. Press Minify to remove comments and unnecessary whitespace.
  3. Compare the before/after counts, then copy or clear.

Examples

  • Rules and comments

    /* note */ .hero { color: #2563eb; } becomes .hero{color:#2563eb;}

  • url() and strings

    Spaces inside quoted strings and url() values are kept. calc() and custom properties keep the spaces they need.

How it works

The CSS minifier walks the source as tokens rather than applying a single naive regex. It removes comments, then drops whitespace that is not required between identifiers, braces and operators. Strings, data URLs and escaped characters stay intact. It is conservative: it will not perform advanced optimizations such as merging selectors.

Limitations

Comments are deleted and spare spaces between tokens are dropped. Spaces inside strings, url() values, and calc() stay. Selectors are not merged, and vendor prefixes are not added. A stylesheet longer than 400,000 characters is refused.

See the disclaimer for what these tools do not cover.

FAQ

Is the CSS Minifier free?
Yes. You can minify a stylesheet in this browser without paying or creating an account.
Can this break my stylesheet?
Unusual hacks or files that are not CSS can still fail. Valid everyday stylesheets should minify cleanly. Review the output if you rely on exotic syntax.
Is my input sent to a server?
No. The CSS stays in this tab while it is minified. It is not sent to a server or saved in local storage.
Why minify CSS?
A smaller stylesheet downloads faster. Minifying removes comments and spare whitespace without changing what the rules do.
Can I un-minify CSS later?
You can reformat it, but removed comments are gone. Keep your original, readable file and publish the minified copy.