CSScompressor Nederlands

CSS beautifier

Paste minified CSS and get indented, readable code back. The reverse of compressing: nothing is added or removed, only the layout is restored.

JavaScript is switched off. The button below still works: compression then happens on the server.

When you need a beautifier

Minified CSS is one long line. That is fine for a browser and terrible for a person. A beautifier — also called an unminifier or formatter — puts the structure back: one declaration per line, a tab per nesting level, a blank line between blocks.

Three situations come up again and again:

What a beautifier cannot do

It restores layout, not information. Comments that the minifier removed are gone for good, and so are the original property order choices if a build tool reordered them. Class names that were mangled by a CSS-modules build stay mangled — no formatter can guess what .a3Xk2 used to be called. Keep your source files in version control; a beautifier is a rescue tool, not a backup.

How this one formats

Tabs for indentation, one declaration per line, a space after each colon, and the selector on the same line as its opening brace. Combinators keep their spaces (.a > .b), commas in selector lists get a space after them, and !important keeps a space in front of it. Values themselves are never rewritten, so #fff stays #fff — it does not expand shorthand back out, because it cannot know what you originally wrote.

Does beautifying change how my page renders?

No. Whitespace between declarations has no meaning in CSS, so adding it back cannot change the result. The only exception would be whitespace inside strings, which is left untouched either way.

Can it format CSS that has errors in it?

Mostly. Unclosed braces and stray characters are passed through rather than thrown away, so you can usually spot the mistake in the formatted output. It is not a validator though — for that, use the W3C CSS validator.

Does it work on SCSS or Less?

Partly. Nested blocks and declarations format fine, but preprocessor-only syntax such as mixins, @extend and variables with $ is treated as unknown content and passed through as-is. For SCSS, your preprocessor's own formatter will do a better job.

Other tools on this site

Read more