CSS carries more removable bytes than most people expect. Every declaration indented on its own line, every comment explaining why a hack exists, every trailing semicolon before a closing brace: none of it changes how a single pixel renders. A minifier strips all of it, and this tool does the pass live in your browser, showing the before and after byte counts so the saving is a measurement rather than a guess.
Paste your stylesheet and the compacted result appears immediately. Three transformations are applied: comments are removed, all unnecessary whitespace including indentation and line breaks is stripped, and the last semicolon before each closing brace is dropped because it is optional in CSS grammar. Selectors, properties, values, and at-rule structure are untouched, so the minified file behaves identically to the original.
The tool runs locally; stylesheets with private design tokens, internal class conventions, or unreleased client themes never leave your device. There is no signup and no cost, and the page works on mobile as well as desktop.
Before and After: A Worked Example
Take a realistic hand-written component stylesheet with comments, indentation, and blank lines between rule blocks. Minification compresses it substantially, and the savings scale with how much formatting the source carried:
| Stylesheet | Before | After | Saved |
|---|---|---|---|
| Component styles, heavily commented | 11,400 bytes | 7,900 bytes | 31 percent |
| Theme variables and rules, 2-space indent | 26,800 bytes | 19,100 bytes | 29 percent |
| Print and email styles, tab indent | 6,300 bytes | 4,800 bytes | 24 percent |
The pattern in the first row is worth noting: comments are dense bytes. A stylesheet where every section starts with a three-line explanation can lose close to a third of its size from comment removal alone. The last-semicolon optimization is small but free, typically one byte per rule, which on a thousand-rule bundle is about a kilobyte.
An honest framing for these numbers: minification and server compression are different layers. Gzip or Brotli on the server typically removes another 70 to 80 percent from whatever the minifier leaves, and minified input compresses slightly better than formatted input because repetition and padding are gone. Run both; minification is the build step, compression is the server configuration, and neither substitutes for the other.
How to Use the Minifier (Step by Step)
- Paste the CSS you want to compact. Minification runs live, and byte savings appear next to the output.
- Skim the result briefly. The main thing to look for is a comment you actually need to keep, such as a license header, because comments do not survive.
- Copy the minified CSS into your build output or production stylesheet.
- Keep the formatted original in your repository as the source of truth and re-minify on each deploy, never editing the minified file by hand.
Why the Last Semicolon Goes
CSS grammar allows the final declaration in a block to omit its trailing semicolon, because the closing brace terminates the declaration regardless. Every semicolon before a closing brace is therefore a removable byte. The minifier drops them all. The same logic applies to whitespace around colons, commas, and combinators: color: #ff0000 and color:#ff0000 are identical to the parser, and the minifier keeps the compact form throughout.
One precision note: the minifier removes whitespace between tokens but does not perform the deeper rewrites that dedicated build-time minifiers can, such as merging shorthand properties, converting colors to shorter notations, or renaming classes. Those transformations interact with the rest of your stylesheet and JavaScript, and they deserve a tested build pipeline. What this tool removes is the safe subset: comments, whitespace, and optional semicolons, all provably invisible to the renderer.
One Rule, Before and After
A single block shows every transformation at once. Imagine a card component written the way humans write CSS: the selector on one line, an opening brace, two spaces of indent per declaration, a comment above the box-shadow line explaining the soft-light trick, a trailing semicolon after the final declaration, and a blank line before the closing brace. That block spans roughly nine lines and about 310 bytes. After minification it is one line of about 215 bytes: the comment is gone, the indentation and blank lines are gone, the spaces around colons are gone, and the trailing semicolon before the brace is gone. The rendered card is identical in both versions; the browser cannot tell them apart, because none of the removed characters participates in the cascade.
Multiplying that single-rule ratio across a real stylesheet is exactly what the byte report does for your input. The savings shown earlier, in the 24 to 31 percent range, are just this local effect accumulated over every rule, comment, and blank line in the file.
What Gets Preserved
Everything that affects rendering survives. Media query structure is intact, so responsive behavior is unchanged. Keyframe animations keep their percentages and properties. Vendor-prefixed properties and at-rules pass through exactly. Custom properties, the var declarations that theming systems depend on, are untouched, including the important distinction between a variable defined on a root element and one overridden deeper in the cascade.
Strings need no special handling because they contain no removable whitespace by definition; a font name with spaces keeps its spaces and its quotes. Comments inside the stylesheet are the one category that is deliberately not preserved, with the exception of nothing: all comments go. If a license header must remain in production CSS, add it back at the top of the minified output as a single comment, or serve license information in a separate file, which is the approach most build tools take.
The Deployment Workflow
The reliable pattern mirrors every other asset on a modern site: a formatted master in source control, a minified artifact at build time. If you inherit a minified stylesheet that needs editing, run it through the paired beautifier first, make the change in readable form, and minify again. Hand-editing minified CSS is a reliable source of subtle bugs, because a single deleted semicolon in a long unbroken line is almost invisible during review.
Minifying before minifying, so to speak, is also a reasonable audit step: run the tool on your current production stylesheet and compare the byte savings. A large saving means the deployed file was shipped without minification and visitors have been downloading formatting bytes; a small saving means your build pipeline is already doing its job.
Tips and Best Practices
- Minify at build or deploy time from a formatted master, and never edit minified output directly.
- Move documentation comments into the repository or a separate doc file before stripping them from production CSS.
- Pair with server compression for the full effect; the numbers in this tool measure the minification layer only.
- Re-add a license header as a single comment at the top of minified output when attribution requires it.
- Use the byte report to audit whether your current production CSS was actually minified.
- Round-trip check after minifying a critical theme: load the page and confirm custom-property overrides still apply in the expected order.