toolqik

198 · CSS

CSS to SCSS Converter

Turn flat CSS into nested SCSS with & selectors, nested media queries and colour variables.

Runs in your browser
Indent
Nest
Options
SCSS

  

About this tool

Paste plain CSS and get SCSS with the selectors nested: .card h2 moves inside .card, .btn:hover becomes &:hover inside .btn, and BEM classes like .card--featured become &--featured. Media queries move inside the rules they change, and colours used more than once become named variables ($royalblue, from the nearest CSS colour name).

About cascade order

Nesting groups rules by selector, which can move a rule earlier or later in the compiled CSS. That only matters when two rules with the same specificity target the same element and set the same property: then the later one wins. If your stylesheet relies on that, turn on Keep rule order, which only merges rules that were already next to each other.

What stays the same

Values, comments, @font-face, @keyframes, @supports and custom properties are kept as written. Selector lists such as h1, h2 stay together as one block. Compile the result back with the SCSS to CSS Converter to check it produces the same styles.

Native CSS nesting now works in all current browsers too, so if you only want nesting, the output (without variables) is close to valid modern CSS.

FAQ

How do I convert CSS to SCSS?

Paste the CSS. Since all valid CSS is valid SCSS, conversion means restructuring: nesting selectors, using & and extracting variables, which this tool does.

Is any CSS valid SCSS?

Yes. You can rename a .css file to .scss and it compiles. Converting just makes it shorter and more maintainable.

How are variable names chosen?

Each repeated colour is named after the nearest CSS colour name, such as $royalblue or $tomato, with a number if two are close to the same name.

Will the compiled CSS be identical?

Selectors and declarations are the same, but rules may be grouped in a different order. Turn on “Keep rule order” if your styles depend on source order.

Is my CSS uploaded?

No. The conversion runs in your browser.

esc
↑↓ navigate↵ open