CSS to SCSS Converter
Paste plain CSS and get nested SCSS back. Related selectors are folded under their parent with an ampersand where it fits, media blocks are kept and repeated colours can become variables.
Use the tool
Why this tool exists
Moving a stylesheet to Sass usually starts with a flat CSS file where .card, .card:hover and .card .title all repeat the same prefix. Nesting them by hand is tedious and easy to get wrong, and finding every colour that appears three times is worse. Teams do this when they adopt Sass for a legacy project or when they pull a design handoff into an SCSS codebase.
This converter does the mechanical part. It nests selectors that extend an earlier one, keeps media and supports blocks, and can pull repeated colours into dollar variables. Selector lists with commas are left alone, so review the output before committing. It runs in your browser and your stylesheet is not uploaded.
How to use it
- Paste your CSS into the input box.
- Tick the option to extract repeated colours into variables if you want them.
- Read the generated SCSS and check how each rule has been nested.
- Copy the result into a .scss file and compile it to confirm the output matches the original.
Frequently asked questions
Will the compiled CSS match my original exactly?
Usually, but not always. Nesting depends on the order of the rules, and the tool leaves comma-separated selector lists untouched. Compile the result and compare it with your original before relying on it.
What counts as a repeated colour?
A colour value that appears two or more times is moved to a numbered dollar variable at the top of the file. Single-use colours stay where they are.
Does it convert SCSS back to CSS?
No, this tool goes from CSS to SCSS only. For the other direction use the SCSS to CSS compiler, which handles a practical subset of the language.