SCSS Formatter
Clean up SCSS so that nesting and declarations read clearly.
INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0
How the SCSS Formatter works
The formatter understands SCSS syntax beyond plain CSS: nested rules, parent selectors with an ampersand, variables, mixins and includes, functions, maps and control directives such as if and each. It prints each construct with consistent spacing and indentation.
Line comments, which are valid in SCSS but not in CSS, are preserved. If the input cannot be parsed, the first error is reported with its position.
SCSS Formatter examples
Format nested SCSS declarations
Input
.navbar{background:#fff;ul{list-style:none;li{display:inline-block;&:hover{color:#ff6600;}}}}Result
.navbar { background: #fff; ul { list-style: none; li { display: inline-block; &:hover { color: #ff6600; } } } }
When it is useful
- •Normalizing partial files from different contributors.
- •Reading deeply nested styles that were written on one line.
- •Checking that a snippet is valid SCSS.
- •Preparing code for review or documentation.
Frequently Asked Questions
Does it compile SCSS to CSS?
No, it only formats. To get CSS you need a compiler such as Dart Sass.
Can it format indented Sass syntax?
No. It expects SCSS with braces and semicolons.
Is the order of my rules changed?
Never. Formatting only changes whitespace and line breaks.
Related tools
- CSS FormatterPaste CSS and get tidy, consistently indented code, or a compact minified version.
- HTML Formatter, Minifier and BeautifierClean up markup, or squeeze it down for production.
- Color ConverterType or pick a color and copy it in any format.
- JavaScript FormatterMake minified or messy JavaScript readable.