SCSS Beautifier and Formatter
WM-79Paste SCSS to format it with consistent indentation and spacing. Nested rules, variables, mixins and // comments are understood and kept.
Runs in your browser. Nothing is uploaded.
SCSS
Formatted SCSS
How to use it
- Paste your SCSS into the input box, or open a .scss file.
- Pick 2 spaces, 4 spaces or a tab for the indent.
- Tick single quotes if you want them in strings.
- Copy the formatted SCSS or download it as a .scss file.
What it understands
The formatter is Prettier with the PostCSS parser in SCSS mode. It reads nested rules, the & selector, variables, @use and @import, @mixin and @include, @function, maps, placeholder selectors and // line comments. Each declaration goes on its own line, nested rules are indented a level, and spacing around colons, commas and operators is made uniform. Comments are kept.
What it normalizes
Prettier lowercases hex colors and units and adds a leading zero to numbers such as .5. Selectors and property names are not renamed, merged or reordered, and values are not recalculated. A one-line rule is expanded, and a semicolon is added after the last declaration in each block. The SCSS is not compiled, so you do not get CSS output.
Limits
The indented Sass syntax, the one without braces and semicolons, is not supported, and Less needs a Less formatter. Undefined variables and misspelled mixins are not detected because nothing is compiled. If the braces do not match, you get an error with a line and column and no output.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Invalid SCSS: Unclosed block at line 1, column 1 | A { has no matching }. | Add the closing brace for the block that starts at the position shown. |
Questions people ask
How do I format SCSS online?
Paste the SCSS and the formatted version appears as you type. Pick the indent and quote style, then copy it or download it as a .scss file. Nesting, variables and mixins are kept as written.
Does it keep my // comments?
Yes. Line comments with // and block comments are both kept, and stay beside the code they were written with. Plain CSS minifiers drop // comments or break on them, which is why SCSS needs its own parser.
Why did my hex colors turn lowercase?
Prettier writes hex colors in lowercase, so #FFF becomes #fff. It also lowercases units, so 10PX becomes 10px, and adds a leading zero to .5 to give 0.5. The values are the same, only the spelling changes.
Does it compile SCSS to CSS?
No. It only formats the SCSS source. Nothing is compiled, so there is no CSS output, and undefined variables or mixins are not detected. Use a Sass compiler to build the CSS.
Can it format the indented Sass syntax?
No. The .sass syntax without braces is not supported. Convert it to SCSS first, or use a Sass-aware tool. This page expects braces and semicolons.
What is the difference from the CSS beautifier?
The CSS beautifier reads plain CSS and uses a different engine. SCSS adds nesting, variables and // comments, which plain CSS tools can mangle. Use this page for .scss files and the CSS tools for .css files.
About this tool
Uses the Prettier PostCSS parser in SCSS mode, so nesting, variables, @use, mixins, maps, placeholders and // comments are understood. Only layout changes: indentation, line breaks, spacing and, if you ask, quote style. Prettier lowercases hex colors and units and adds a leading zero to numbers like .5. Values and selectors are not renamed, merged or reordered, and the SCSS is not compiled, so output CSS is not shown and undefined variables are not detected. The indented Sass syntax (no braces) is not supported. Unclosed blocks and similar errors are reported with their line and column.