Code Formatters
CSS Formatter
Format CSS into readable, consistently indented rules — including nested rules, media queries, custom properties (variables), and calc() expressions — using Prettier's CSS parser.
Advertisement
Advertisement
Related tools
Features
- Formats nested rules, media queries, custom properties, and calc() expressions correctly
- 2, 4-space, or tab indentation
- Preserves comments
How to use
- Paste minified or messy CSS into the input.
- Pick an indentation size and click Format.
- Copy the result or download it as a file.
Example
Input
:root{--gap:8px}.a{margin:calc(1rem + var(--gap))}Output
:root {
--gap: 8px;
}
.a {
margin: calc(1rem + var(--gap));
}Advertisement