SCSS Formatter

Format and beautify SCSS code.

Local Your input is processed locally in your browser. The first run loads the open-source Prettier library from this site; your input is not sent anywhere. Found a problem? Report an issue

What the SCSS Formatter does

The SCSS Formatter formats SCSS with Prettier 3.3.3, an open-source code formatter, running in your browser. It supports SCSS variables, nesting, mixins and the & parent selector.

SCSS Formatter examples

The built-in sample

Input

$gap:8px;@mixin pad($n){padding:$n}.card{@include pad($gap);&__title{font:{weight:bold;size:2em}}}

Output

$gap: 8px;
@mixin pad($n) {
  padding: $n;
}
.card {
  @include pad($gap);
  &__title {
    font: {
      weight: bold;
      size: 2em;
    }
  }
}

This is the input that the Load sample button fills in.

Maps and interpolation

Input

// note
$m:(a:1,b:2);.a{width:calc(100% - #{$gap})}

Output

// note
$m: (
  a: 1,
  b: 2,
);
.a {
  width: calc(100% - #{$gap});
}

A map is printed with one entry per line and a trailing comma. The #{...} interpolation inside calc() is preserved.

Each output was produced by running this tool on the input above it.

How it works

The code is parsed with Prettier's scss parser and printed again from its syntax tree, using Prettier's default options: lines up to 80 characters and two-space indentation. The result therefore does not depend on how the input was laid out. If the code cannot be parsed, the parser's message with its line and column is shown instead of output.

Details and limits

  • This is for the SCSS syntax with braces. The indented Sass syntax (.sass files) is not supported and gives a syntax error.
  • Nested properties, @mixin, @include, @use, maps and placeholder selectors are kept as SCSS; nothing is compiled.
  • Both // and /* */ comments are preserved.

Questions

Is my data uploaded when I use SCSS Formatter?

No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.

What does SCSS Formatter do?

The SCSS Formatter formats SCSS with Prettier 3.3.3, an open-source code formatter, running in your browser. It supports SCSS variables, nesting, mixins and the & parent selector.

How does SCSS Formatter work?

The code is parsed with Prettier's scss parser and printed again from its syntax tree, using Prettier's default options: lines up to 80 characters and two-space indentation. The result therefore does not depend on how the input was laid out.

Are there any limits I should know about?

This is for the SCSS syntax with braces. The indented Sass syntax (.sass files) is not supported and gives a syntax error. Nested properties, @mixin, @include, @use, maps and placeholder selectors are kept as SCSS; nothing is compiled.

Is there a size limit?

There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.

Does it work on phones, and is it free?

Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.