Skip to content
Buy me a coffee
Minifiers / Beautifiers

CSS Beautifier / Formatter

Formats CSS files with the chosen indentation level for optimal readability.

0 characters · 0 lines
Option 2: Or upload your CSS file
Ctrl + Enter

About the CSS beautifier

The beautifier turns a minified or badly indented stylesheet into readable CSS: every rule gets its own block, every declaration its own line, nested at-rules (@media, @supports, @keyframes, @font-face…) are indented, and a consistent space is placed after each colon and around combinators. It works on plain CSS as well as on SCSS and Less sources, and everything is processed locally in your browser.

Options

OptionEffect
Indentation levelSpaces (or a tab) added for each nesting level: declarations inside a rule, rules inside an at-rule.
Blank line between rulesInserts an empty line after every closing brace so that rules are visually separated.
One selector per lineBreaks a selector list such as h1, h2, h3 { … } into one selector per line. Unchecked, the list stays on one line with a space after each comma.
Preserve existing line breaksKeeps the blank lines already present in the source (useful to keep sections apart). Unchecked, the layout is entirely rebuilt.
Spaces around combinatorsWrites ul > li + li instead of ul>li+li.
End with a newlineAdds a final line break, as most linters and editors expect.

Example

.card{margin:0 auto;padding:1rem}.card h2,.card h3{color:#333;font-weight:600}@media (max-width:600px){.card{padding:.5rem}}

becomes (tabs shown as four spaces):

.card {
    margin: 0 auto;
    padding: 1rem
}

.card h2,
.card h3 {
    color: #333;
    font-weight: 600
}

@media (max-width:600px) {
    .card {
        padding: .5rem
    }
}

The opposite operation, producing the smallest possible file for production, is done by the CSS minifier.