About CSS Formatter
Format CSS with consistent indentation, minify it for production with selector compaction and zero-unit cleanup, or sort declarations alphabetically per rule. Comments and at-rules (<code>@media</code>, <code>@keyframes</code>, <code>@supports</code>) preserve their nesting structure cleanly.
What CSS formatting addresses
CSS files grow. The first declaration is clean; the 500th is a mess of squished selectors, inconsistent spacing, and comments from three different developers. A formatter resets the surface so the structure is readable again.
The non-trivial pieces:
- Selector grouping —
a, .b, #creflows when the line gets long - Nested rules —
@media,@keyframes,@supportsget proper indent - Property alignment — colons line up cleanly per rule
- Comments — preserved at their declared depth
- At-rule arguments — multi-line breakpoint lists handled
Common workflows
Audit a stylesheet for ordering bugs. Sort declarations alphabetically. If the visual changes, you had order-dependent CSS — refactor with explicit specificity.
Diff two CSS files. Format both, drop into the Diff Checker. Comment-only and whitespace-only differences vanish; real changes surface.
Prepare CSS for production. Format → review → minify. The two-pass workflow catches mistakes before they compress.
Convert utility-first to plain CSS. Use CSS to Tailwind to extract utilities, or paste plain CSS to format from a Tailwind extraction.
Why local
CSS rarely contains secrets, but pasting your full stylesheet into a remote formatter still surfaces internal class names, layout choices, and brand colors that may be sensitive pre-launch. Ours runs in the browser, no upload, no log.
Frequently asked questions
What does "minify" actually remove?
0px → 0), duplicated whitespace inside selectors. Selector groups (a, b) collapse to a,b.Will sorting properties break my CSS?
border: 1px solid; border-color: red). Toggle sorting off if you rely on declaration order.Does it support SCSS / LESS?
@mixin, @include, $vars) parses but may be reformatted in ways your preprocessor disagrees with. Use a preprocessor-aware tool for those.How does it handle <code>@media</code> queries?
What about CSS-in-JS or Tailwind utilities?
Will it minify variables?
--color-accent) keep their names. Renaming would require knowing every usage in your stylesheet — a job for a real bundler.Related tools
Last updated: 2025-01-15