FormatterHQ

CSS to SCSS Converter

Convert plain CSS into nested SCSS. Rules sharing a parent selector are grouped, :hover and friends become &:hover, and child combinators are nested with >.

Input CSS
Output SCSS
Ready.

How to use the CSS to SCSS Converter

  1. Paste your CSS into the Input editor, or use Sample, Upload file or Load URL.
  2. Press Convert. With Auto update on, the SCSS output follows your edits.
  3. Review the nested SCSS and add variables or mixins where values repeat.
  4. Use Copy or Download above the output panel to take the SCSS file with you.

How the CSS to SCSS converter works

SCSS is a superset of CSS, so you could simply rename styles.css to styles.scss. What you would not get is the structure that makes Sass pleasant to maintain. This CSS to SCSS converter parses the stylesheet and nests rules under their shared parent selector: descendants become nested blocks, pseudo-classes become &:hover-style references, and child combinators are kept as > .child. Values are not touched.

Example

.nav{display:flex}.nav ul{margin:0;list-style:none}.nav ul li{display:inline-block}.nav a{color:#333}.nav a:hover{color:#0f766e}.nav > .logo{height:32px}@media (max-width:600px){.nav{flex-direction:column}.nav a{padding:8px}}
.nav {
  display: flex;
  ul {
    margin: 0;
    list-style: none;
    li {
      display: inline-block;
    }
  }
  a {
    color: #333;
    &:hover {
      color: #0f766e;
    }
  }
  > .logo {
    height: 32px;
  }
}

@media (max-width:600px) {
  .nav {
    flex-direction: column;
    a {
      padding: 8px;
    }
  }
}

Seven flat rules became one tree that mirrors the HTML structure. The rules inside the media query were nested the same way within the @media block.

Next steps in Sass

  • Variables: pull repeated values into $brand: #0f766e; and keep them in a partial like _variables.scss, loaded with @use.
  • Media queries inside rules: Sass lets you write @media inside .nav, which keeps a component's responsive rules in one place. Move them manually if you like that style.
  • Mixins for repeated groups, such as focus rings or truncation, with @mixin and @include.
  • BEM names: .card__title can be written as &__title inside .card. The converter does not do this automatically, because in CSS these are unrelated class names.

Splitting the result into partials

A converted stylesheet is a good moment to reorganize. Sass partials are files whose names start with an underscore, such as _nav.scss or _buttons.scss; they are never compiled on their own. Move each top-level block into a partial that matches a component, keep shared values in _tokens.scss, and load everything from one entry file with @use "nav"; lines. The Sass module system then makes each partial's variables and mixins available only where you @use them, which avoids the global naming clashes of the older @import.

Check before you commit

  • Deep nesting reproduces the specificity of the original selectors exactly. If your CSS had long selector chains, the SCSS will be deeply nested; consider flattening.
  • Selector lists (h1, h2) and selectors that already contain & stay as single rules.
  • Compile the result with the SCSS Compiler and compare it with the original to confirm nothing changed.

If you prefer the indented syntax, use CSS to SASS. To format hand-edited SCSS consistently, use the SCSS Formatter. Everything runs in your browser.

Frequently asked questions

Will the SCSS compile back to the same CSS?
It compiles to CSS with the same selectors and declarations. Rule order within nested groups can differ slightly, so compare the result if your styles depend on source order between unrelated selectors.
Does it convert repeated colors into $variables?
No. Values are kept exactly. Introducing variables is a design decision, so it is left to you.
Can it nest BEM classes like .card__title?
No. In CSS, .card and .card__title are unrelated class names, so the converter keeps them as separate rules. You can rewrite them with &__title manually.
What happens to @media blocks?
They stay at the top level, and the rules inside them are nested just like the rest of the file.

Last updated October 3, 2026

Related tools

SCSS to CSS Converter Convert SCSS to CSS online. Compiles variables, mixins and nesting into plain CSS. LESS to SCSS Converter Convert LESS to SCSS online. Rules sharing a selector are nested automatically. SASS to SCSS Converter Convert SASS to SCSS online. Rules sharing a selector are nested automatically. SCSS to LESS Converter Convert SCSS to LESS online. Rules sharing a selector are nested automatically. SCSS to SASS Converter Convert SCSS to SASS online. Rules sharing a selector are nested automatically. SCSS to Stylus Converter Convert SCSS to Stylus online. Rules sharing a selector are nested automatically. CSS to Stylus Converter Convert CSS to Stylus online. Rules sharing a selector are nested automatically. CSS Toggle Switch Generator Generate an accessible CSS toggle switch built on a real checkbox, with custom size, colours, shape and transition, plus the HTML markup. CSS Transform Generator Generate CSS transform values — translate, rotate, scale, skew and 3D rotateX/rotateY with perspective — and see them applied to a live box. CSS Triangle Generator Make pure-CSS triangles with the border trick for tooltips, arrows and carets. Pick direction, size and colour and copy the CSS. CSS Cubic Bezier Generator Edit CSS cubic-bezier() easing curves by dragging control points, compare them with standard easings in a live animation and copy the CSS. Glassmorphism CSS Generator Build a frosted-glass (glassmorphism) card with backdrop-filter blur, transparency, saturation and border. Preview it over different backdrops.