Skip to content
🗜

CSS Minifier

Strip whitespace, comments and redundant values from a stylesheet. Everything runs in your browser, so your CSS is never uploaded.

Runs in your browser

Updated

Original

0 B

Minified

0 B

Saved

0%

Minification only changes formatting, never meaning: strings, url() contents and calc() spacing are all preserved. Level 2 and 3 rewrite colour and unit values and are reversible, but check the result if your build pipeline is strict.

What each level changes

One menu and one checkbox steer the page. Level 1, the default, rebuilds the sheet from the parsed tree, so indentation and the spaces around colons go. Level 2 also collapses six-digit hex codes whose pairs repeat, taking #333333 down to #333, and replaces colour words with hex. Level 3 turns 0px, 0em and 0rem into a bare 0. Remove comments starts unchecked, so notes survive by default.

A worked example

Load sample fills a 256 character sheet holding one .card rule, a media query and a hover rule. Level 1 returns 184 characters and the Saved card reads 28%. Level 2 returns 178 for 30%, since #ffffff becomes #fff. Level 3 trims to 176, or 31%, by rewriting margin:0px as margin:0. The at-rule prelude keeps its space after the colon, printing @media(max-width: 600px), and a rule with no declarations is dropped outright.

How the parse protects meaning

Typing waits 200 milliseconds; the level menu, the checkbox and the Minify button run at once. The scanner tracks strings, comments and url() tokens, so a semicolon inside a data URI never splits a declaration. Sizes format as B below 1024, then one-decimal KB, then two-decimal MB. Copy and Download stay inert while the output is empty; the file saves as styles.min.css. Reverse the job with the css beautifier and confirm the result in the css validator.

Where it stops

  • The level 2 colour pass knows nothing about quotes, so a value of "a red ball" ships as "a #f00 ball".
  • Some swaps make the text longer, because gray costs seven characters against four, and the Saved card clamps anything negative to 0%.
  • A comment inside a block moves to the front of it, followed by a semicolon.
  • Only the first five parse messages are shown, and recording itself stops at 200.
  • Length is counted in characters, so non-ASCII text reports fewer bytes than the file holds.

Questions people ask

Why did the output barely change?

Comments stay unless you tick Remove comments, and a one-line sheet has little left to lose.

Is level 3 dangerous?

It touches only 0px, 0em and 0rem; 0s and 0% are left alone, which a strict build may still flag.

Does my stylesheet leave the browser?

No. The scanner is a local script and nothing is sent.