⚡Free Tools

CSS Minifier & Beautifier

Minify CSS for production or beautify minified CSS into readable rules. A safety check makes sure modern CSS like nesting and range media queries is never dropped, and you see the gzipped size. Nothing is uploaded.

Input CSS
Output

Minify or beautify CSS — without losing a single rule

Paste a stylesheet and press Minify CSS (or Ctrl+Enter) to get the smallest file that still renders the same, ready to copy or download as .min.css. Press Beautify CSS to do the opposite: expand minified CSS from a website or a theme into readable, indented rules with one declaration per line. The stats bar shows the size before and after, the gzipped size, how many rules, declarations and !important flags the file has, how many selectors are repeated, and a palette of every colour used — click a swatch to copy it.

All processing happens in your browser with libraries bundled into this page. Your stylesheet is never uploaded, and the tool keeps working offline once loaded.

Why “safe fallback” matters

Many online CSS minifiers are built on CSSO, an excellent structural optimiser. But the current CSSO release predates two features that every modern browser now supports: CSS nesting (writing &:hover { … } inside a rule) and range media queries such as @media (width >= 600px). In our tests, CSSO silently drops nested rules and whole range media queries — the output is smaller because part of your design is missing.

This tool protects you in two ways. First, before optimising, it scans for syntax CSSO cannot handle — nesting, range media queries, @scope and @starting-style — and switches to safe mode automatically. Second, after CSSO runs, it compares the class names, custom properties and at-rules in your input with the output. If anything that should be there has disappeared, the CSSO result is thrown away and the safe minifier is used instead. Either way you see a note explaining what happened.

What the two modes do

Licence comments that start with /*! are kept by default, because many open-source licences require the notice to travel with the code.

How much will I save?

Hand-written stylesheets typically shrink by 15–40% when minified; framework output that is already compact shrinks less. Compression saves even more: servers send CSS compressed with gzip or Brotli, and Google's web.dev guidance is to minify and then compress. That is why the stats show the gzipped size, measured in your browser with the Compression Streams API — it is the number that affects your page's loading speed and Core Web Vitals.

Beautify minified CSS

Beautify expands CSS with your choice of 2 spaces, 4 spaces or tabs, puts each declaration on its own line, adds a blank line between rules, and can put each selector of a group on its own line. It understands media queries, @supports, @layer, @container, keyframes and nested rules. It is the quickest way to read the CSS of a theme or a site you are debugging, or to clean up a stylesheet before committing it.

Built-in checks

Before anything is minified, the tool checks that every { has a matching }, that comments are closed and that strings end. A missing brace is the most common reason for a broken stylesheet, because the browser then swallows every rule after it. If there is a problem you see the line, a snippet with a caret and a Go to error button, and nothing is minified until it is fixed.

The statistics help with cleanup too. A high number of !important flags usually means specificity problems. Repeated selectors are candidates for merging. A palette with twenty slightly different greys is a sign that the design needs colour variables (--brand, --text-muted).

Common questions from WordPress and Blogger users

If you paste CSS into the WordPress Customizer's “Additional CSS” box, a page builder or a Blogger theme, minifying is optional — those boxes are usually small, and readable CSS is easier to change later. Minify when you add large blocks, or when you copy a stylesheet into a single HTML file such as an email template or a landing page. Keep a readable copy somewhere: beautifying minified CSS restores the layout but not the comments you wrote. When a caching plugin already minifies CSS, do not minify it twice; check the plugin's output instead, and use the stats here to compare sizes.

Tips for smaller, faster CSS

SCSS and Less

Plain CSS output from Sass or Less can be minified here. Uncompiled SCSS or Less with variables, mixins and @include is not CSS yet — compile it first. Beautify will still lay out SCSS nesting readably.

Privacy, offline use and limits

Everything runs locally. Drafts, options and the last 12 inputs are stored only in this browser's localStorage and can be cleared from the History dialog. The tool has been tested with stylesheets over 1 MB. Minification never fixes invalid CSS; if a rule is broken, fix it first.

Sources and references

Frequently asked questions

Is my CSS uploaded?

No. CSSO and js-beautify are bundled with this page and run in your browser. Nothing is sent to a server, and the page works offline after loading.

Will minifying break my CSS nesting or @media (width >= 600px)?

No. Those features are detected and minified in safe mode, which only removes comments and optional whitespace. After every CSSO run the tool also checks that no class, custom property or at-rule went missing.

What is the difference between the two modes?

CSSO also shortens colours and values and can merge rules, so it saves more. Safe mode removes only comments and optional whitespace, so the output is guaranteed to contain every rule in the original order.

Should I untick Merge rules?

Untick it if your design relies on the exact order of rules in the cascade. Merging is safe for most stylesheets but can move a rule.

How much smaller will my CSS get?

Usually 15–40% for hand-written CSS before compression. The gzipped size shown is what browsers actually download when your server uses gzip.

Can I minify SCSS or Less?

Compile it to CSS first. Plain CSS output from Sass or Less minifies fine; beautify also lays out SCSS nesting.

Keyboard shortcuts

Ctrl + EnterMinify CSS
Ctrl + Shift + BBeautify CSS
Ctrl + Shift + CCopy output
Ctrl + SDownload .css