How to use CSS Beautifier & Minifier
What it does & when you need it
You inherit a stylesheet that arrived as one 4,000-character line with no breaks, or you've hand-written CSS and want to ship it as small as possible. This tool does both directions. Beautify re-indents a compressed or messy stylesheet into readable, consistently formatted rules so you can actually review a diff or debug a selector. Minify strips comments and collapses insignificant whitespace to shrink the file you serve. Everything runs in your browser on the same string — paste proprietary or unreleased styles and nothing is uploaded anywhere.
Reach for it when you're auditing a third-party theme, preparing inlined
critical CSS for a <style> block in your <head>, cleaning up generated
output before committing, or just making a minified file legible enough to
understand what a rule is doing.
How to use
- Paste your stylesheet into the input.css buffer, press Sample to load
an example with comments and nesting, or Upload a
.cssfile. - Pick a mode with the Beautify / Minify toggle. The output pane updates as you type — there's no separate run step.
- On Minify, the output status bar reports the before/after size, e.g.
1,240 → 820 bytes, so you can see exactly what you saved. - Press Copy output (or
Ctrl/Cmd+Enter) to grab the result, or use the Copy button on the output buffer.
Things worth knowing
Minifying is safe because most CSS whitespace is insignificant — but not all
of it. Collapsing the spaces and newlines between rules and declarations
changes nothing about how the browser parses them. The exceptions are the places
where a space is a real token: inside calc(100% - 32px) the spaces around the
operator are required, and in multi-value properties like margin: 0 auto the
gap separates two values. This tool preserves those and only removes the
whitespace that genuinely doesn't matter, so minified output renders identically
to the source.
Minification never touches specificity or source order. It doesn't reorder declarations, merge selectors, or rewrite anything semantic — it only deletes comments and redundant whitespace. Because the cascade depends on specificity and the order rules appear, and both are untouched, your page looks exactly the same before and after. That's what makes it a mechanical, low-risk build step.
It won't expand or collapse shorthand. Turning margin: 0 auto into four
margin-* longhand declarations, or folding four longhands back into one
shorthand, is a separate transformation with its own edge cases (like how
margin resets all four sides). This tool deliberately leaves shorthand exactly
as you wrote it.
Over HTTP, the win is smaller than you'd think. If your server sends CSS with gzip or brotli — nearly every host does — the compressor already eliminates most of the repeated whitespace on the wire, so minifying on top of that saves relatively few transferred bytes. Where minification still earns its keep is the uncompressed parse size the browser works with after decompression, and especially inlined critical CSS, where every character sits in your HTML and isn't always compressed the same way.
Once your CSS is clean, you might tidy the surrounding HTML or a script bundle the same way, sanity-check a color you spotted with the color converter, or format the JSON config that generated the stylesheet.