CSS Beautifier & Minifier
Format compressed CSS with clean indentation for nested @media and @supports rules, or minify stylesheets while keeping calc() spacing, strings, and url() paths intact.
About This Tool
Formats minified CSS stylesheets into indented rulesets (including nested @media, @supports, @container, and @keyframes blocks), or minifies CSS by stripping comments, whitespace, redundant semicolons, and zero units.
Unlike naive regex replacers, this parser protects spaces around + and - inside calc(), clamp(), min(), and max() so CSS math functions never break.
Key Features
- Safe calc() & clamp() handling: Preserves required whitespace around + and - operators inside CSS math functions during both minification and formatting.
- Nested at-rule indentation: Indents @media, @supports, @container, and @keyframes blocks to arbitrary nesting depth.
- Zero-unit & hex shorthand optimization: Collapses 0px/0rem/0em to 0 and shortens 6-digit hex colors (#ffffff to #fff) when minifying.
- String & url() protection: Leaves quoted strings and url(...) arguments untouched even if they contain colons, braces, or spaces.