Skip to main content
Tools Star Hub

CSS Minifier

Minify CSS in your browser while preserving strings, URLs, comments and important spacing.

What is CSS Minifier?

A CSS minifier compresses stylesheets by removing comments and unnecessary whitespace.

Loading tool…

This tool runs in your browser. Inputs, files and generated values stay on this device. Favorites and recently used tools, if you use them, store only tool names in local storage — never passwords, documents or QR contents. See the privacy policy.

CSS Minifier — Minify Stylesheets in Your Browser — Tools Star Hub

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.