Loona Automation logoLoona Developer Tools
Home › Developer Tools › CSS Minifier

CSS Minifier & Beautifier - Compress CSS or Make It Readable

In short: the CSS Minifier strips comments and unnecessary whitespace to shrink your stylesheet and reports the exact size saving, while Beautify mode turns minified CSS back into clean, indented code.

Every kilobyte of CSS delays the first paint of your page. Paste a stylesheet below to compress it for production, or run a minified file through Beautify when you need to read and edit it again.

Original size-
Result size-
You saved-
Private by design: everything in this tool happens 100% in your browser with JavaScript. Your input is never uploaded to a server, never stored and never seen by us - close the tab and everything is gone.

How to use the CSS Minifier

  1. Paste or type your CSS into the top box.
  2. Click Minify CSS to compress it, or Beautify CSS to format it with indentation.
  3. Check the size panel - it shows the original size, result size and percentage saved.
  4. Copy the result or download it as a .css file.

How it works

The minifier first walks your CSS character by character and removes comments - while leaving quoted strings completely untouched, so a content value that happens to contain comment-like text survives intact. It then collapses whitespace runs and removes spaces around braces, semicolons, commas and combinators, plus the space after colons. It deliberately never touches the inside of calc() expressions or string values, where spaces carry meaning. Beautify mode reverses the process: it re-opens the compressed CSS into one declaration per line with two-space indentation per nesting level.

Worked example

A typical hand-written stylesheet rule with comments and generous spacing - say a 240-byte header block - usually minifies to around 150 bytes, a saving of roughly 35-40%. Across a whole site that adds up to a visibly faster first render, especially on mobile connections.

Frequently Asked Questions

Is this CSS minifier free?

Yes - completely free, with no sign-up, no size limit and no daily cap.

Is minified CSS safe to deploy?

The minifier only removes comments and whitespace that CSS does not need. Selectors, properties and values are unchanged, and string values and calc() expressions are never altered. As with any minifier, test the page once after deploying.

Why does it keep a space before a colon in selectors?

A space before a colon can be meaningful in CSS - ".a :hover" selects hovered descendants, while ".a:hover" selects the element itself. To stay safe, the tool removes the space after colons but never guesses with the space before one.

Can it beautify CSS as well?

Yes. Beautify mode takes compressed CSS and expands it to one declaration per line with consistent indentation, which is ideal when you inherit a minified file and need to edit it.

Is my CSS uploaded to a server?

No. Minifying and beautifying happen 100% in your browser. Your stylesheets never leave your device.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.