Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

CSS to SCSS Transformer

Transform plain CSS into clean SCSS with nested selectors, variables, and &-prefixed pseudo-classes

Your files never leave your browser
CSS Input0 chars, 0 lines
SCSS Output0 chars, 0 lines
Ready·

Paste flat CSS in, get nested SCSS out — selectors grouped under shared parents, repeated colors pulled into $variables, and pseudo-classes converted to & syntax. Turns a messy 500-line stylesheet into something a team can actually maintain.

Pick your max nesting depth, toggle auto-variables on or off, and hit Transform. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste CSS
➔
Parse & Nest Selectors
➔
SCSS Output

The parser breaks your CSS into individual rule blocks, then groups selectors that share a common ancestor. .nav .item and .nav .link both get nested inside .nav { }. Pseudo-classes like :hover become &:hover. If you turn on auto-variables, any hex, rgb, or hsl color that shows up three or more times gets extracted into a $variable at the top of the output.

Examples

Nesting a navigation component

You have flat CSS for a navbar with links, hover states, and an active class. The converter groups them under one parent.

INPUT
.nav { display: flex; } .nav a { color: #333; } .nav a:hover { color: #0066cc; } .nav .active { font-weight: 700; }
OUTPUT
.nav { display: flex; a { color: #333; &:hover { color: #0066cc; } } .active { font-weight: 700; } }

Extracting repeated colors into variables

Same blue showing up everywhere? Turn on auto-variables and the converter pulls it out for you.

INPUT
.btn { background: #2563eb; } .link { color: #2563eb; } .badge { border-color: #2563eb; } .heading { color: #1e293b; }
OUTPUT
$color-1: #2563eb; .btn { background: $color-1; } .link { color: $color-1; } .badge { border-color: $color-1; } .heading { color: #1e293b; }

Media queries with nested rules inside

The converter keeps your @media blocks intact and still nests the selectors within them. Handy for responsive layouts that share parent selectors.

INPUT
@media (max-width: 768px) { .card { padding: 1rem; } .card .title { font-size: 1rem; } .card .body { font-size: 0.875rem; } }
OUTPUT
@media (max-width: 768px) { .card { padding: 1rem; .title { font-size: 1rem; } .body { font-size: 0.875rem; } } }

Who Uses This

👨‍💻 Front-End Developers

Migrating legacy CSS codebases to SCSS without rewriting every file from scratch.

🎨 Designers Who Code

Turning exported CSS from design tools into organized SCSS with proper nesting.

🎓 Students

Learning how SCSS nesting and variables work by seeing their existing CSS converted side-by-side.

💼 Team Leads

Standardizing a project on SCSS when half the stylesheets are still plain CSS.

Common Mistakes

Setting nesting depth too high

Deep nesting (5+ levels) produces SCSS that compiles into bloated, overly specific selectors. Keep it at 3 or 4 max. If the output looks like a Russian nesting doll, lower the depth setting.

Expecting the output to compile differently than the input

The SCSS this tool generates should compile back to the exact same CSS you started with. It is a structural reorganization, not a rewrite. If the compiled output looks different, check for specificity changes caused by nesting order.

Forgetting to rename the file extension

SCSS files need a .scss extension, not .css. Your build tool won't process the nesting or variables if the file is still named styles.css. Rename it before importing.

Technical Details

Frequently Asked Questions

What's the difference between SCSS and Sass?

SCSS uses curly braces and semicolons, just like regular CSS. Sass uses indentation instead — no braces, no semicolons. Most teams pick SCSS because any valid CSS file is already valid SCSS, so migration is painless. This tool outputs SCSS specifically.

Will the converted SCSS compile back to my original CSS?

Yes. The conversion is purely structural. Selectors get nested and repeated colors become variables, but the compiled output should match your original CSS rule for rule. If something looks off, check the nesting depth — very deep nesting can sometimes reorder specificity.

Does this handle @media queries and @keyframes?

Media queries are preserved as-is, and the rules inside them still get nested. Keyframe blocks pass through untouched since they don't benefit from selector nesting.

Is my CSS sent to a server?

No. Everything happens in JavaScript right in your browser tab. Disconnect from the internet and it still works. Your code is never uploaded, logged, or stored anywhere.

Can I convert SCSS back to plain CSS?

That's a different process — you'd need an SCSS compiler like Dart Sass or the sass npm package. This tool goes one direction: flat CSS in, nested SCSS out. For the reverse, check out a dedicated SCSS compiler tool.

Share: