Converter · SOTA Tokenizer · comment-safe
CSS Formatter & Minifier
Format, prettify, or minify CSS with configurable indent. Preserves comments, supports CSS Level 4 (Container Queries, :has, Cascade Layers), and handles nested selectors (CSS Nesting Level 1).
How to Use CSS Formatter in 3 Steps
- Configure. Paste CSS into the input. The tool auto-detects whether to prettify minified CSS or minify pretty CSS.
- Process. Choose indent (2 or 4 spaces, or tabs), comment preservation (keep or strip), and property sorting (none / alphabetical).
- Export. Copy the formatted output. Valid CSS structure is preserved — no selector or value is modified, only whitespace.
Why CSS Formatter on Pixlane
CSS formatting is needed for reviewing minified stylesheets, cleaning up IDE-exported code, preparing production bundles, and normalizing formatting across a team. Pixlane's tokenizer handles CSS Level 4 features — Container Queries, :has(), Cascade Layers, native Nesting — that many older formatters miss.
- CSS Level 4 Aware — Handles Container Queries (@container), :has(), Cascade Layers (@layer), Nesting (&), subgrid, anchor positioning — the modern CSS spec.
- Bidirectional — Same tool for prettify and minify. One click switches between production-ready compact and human-readable expanded output.
- Comment-Safe Tokenizer — Character-by-character tokenizer preserves comments, strings, and URLs exactly. No regex edge cases.
- Property Sorting — Optional alphabetical property sort produces consistent diffs when reviewing style changes.
Frequently Asked Questions
Does it handle CSS Nesting?
Yes. CSS Nesting Level 1 (shipped in all browsers 2023-2024) is tokenized correctly — nested rules remain nested with proper indentation.
Does minification change my CSS behavior?
No. Minification removes whitespace and comments only. Selectors, declarations, and values are preserved byte-for-byte. The output is semantically identical.
Is my CSS sent to a server?
No. Formatting happens entirely in your browser. Your stylesheets — which may contain proprietary design systems — never leave your device.
Is this tool free?
Yes. CSS Formatter on Pixlane is completely free with no signup required.