ModernCalcs

SCSS to CSS Converter

Substitutes $variables and flattens nested selectors. Mixins and extends are not supported.

SCSS to CSS Converter: Compile Variables and Nesting Without Sass

SCSS's two most-used features — $variables and nested selectors — can be compiled to plain CSS without installing Sass or running a build pipeline. Paste your SCSS, and this tool substitutes all variable references and flattens nested selectors into flat, browser-ready CSS.

Formula
// Variable substitution $primary: #3b82f6; color: $primary; → color: #3b82f6; // Nesting flattening .card { .title { color: $primary; } } → .card .title { color: #3b82f6; } // & parent reference .btn { &:hover { opacity: 0.9; } } → .btn:hover { opacity: 0.9; }

Multiple passes of variable substitution handle chained variables ($a: $b; $b: red;). Mixins, @extend, and math expressions are not evaluated.

Variable Substitution

SCSS $variable declarations are collected first (multiple passes to resolve chained variables like $a: $b where $b is also a variable). All references to each variable throughout the file are then replaced with their resolved values. The variable declarations themselves are removed from the output.

Nesting Flattening

Nested selectors are flattened recursively. The parent selector is prepended to each nested selector with a space. The & symbol is replaced with the full parent selector, enabling patterns like .btn { &-primary {} } → .btn-primary {}. @media and @supports blocks are handled by recursively flattening their contents with the same parent selector.

Limitations vs Dart Sass

This browser-based converter handles variables and nesting, which covers 80% of typical SCSS usage. It does not evaluate math expressions ($a + $b), call functions (darken(), mix()), expand mixins (@include), or process @extend. For full SCSS compilation, install Dart Sass as a CLI tool or use the sass npm package in your project.

Practical Examples

Compiling a Component's SCSS to Embed in a Page

Take a component's .scss file and produce embeddable CSS without a build step.

  • 1.Paste the component SCSS with $variables and nesting
  • 2.The flattened CSS appears immediately on the right
  • 3.Review that selectors and values are correct
  • 4.Copy the CSS and embed in a