SASS to CSS Converter Online — Free Tool
SASS to CSS Converter
Paste indented Sass (the .sass syntax, with no braces or semicolons) and get CSS back. The converter uses the same sass package as the SCSS compiler. It runs in your browser, and the tool code makes no network request with your input.
How this tool compiles it
sassToCss in src/lib/Lang/v2/css/CssService.ts makes two attempts:
- It compiles the input with
syntax: "indented"andstyle: "expanded". - If that throws for any reason, it compiles the same text as SCSS.
If the second attempt also throws, the tool returns Error: followed by that second attempt's message.
Consequences:
- SCSS input also compiles.
$a: 2px;followed by.x { margin: $a; }gives.x { margin: 2px; }. - The error text comes from the SCSS parser when the indented parse fails, so a message can mention
{or;in a file that is indented. - Like the SCSS compiler, there is no importer, so partial files cannot be imported.
Worked example
Input:
$brand: #3b82f6
$pad: 8px
=rounded($r: 6px)
border-radius: $r
.card
padding: $pad
+rounded
&:hover
border-color: $brandOutput from this tool:
.card {
padding: 8px;
border-radius: 6px;
}
.card:hover {
border-color: #3b82f6;
}Gotchas
1. The error names the SCSS parser
Before:
.a
color: $nopeAfter: Error: expected "{". The indented attempt's error is discarded, so the message you see comes from the SCSS retry. It does not describe the indented input.
2. A missing partial shows a semicolon error
Before:
@import "partials/vars"
.a
color: redAfter: Error: expected ";". The message comes from the SCSS retry, so it does not say that the file was not found.
3. A line at the wrong depth breaks the parse
Before:
.a
color: red
margin: 0After: Error: expected "{". The margin line does not match the depth of its sibling, and the error points at it (line 3). Keep each declaration at the same indentation under its selector.
The mixin is defined with =rounded and included with +rounded. Its border-radius declaration appears at the position of the include, which is why it comes after padding in the output. Both = and + are indented-syntax forms, so keep them out of files you plan to run through the SCSS compiler.
FAQ
Does it accept SCSS too?
Yes. The second attempt compiles SCSS-syntax input, so a file with braces and semicolons also produces CSS.
Why does my indented file report an expected brace?
The message is the SCSS parser's, from the retry. See gotcha 1.
Can it resolve my partial files?
No. The converter sees only the pasted text. See gotcha 2.