FormatterHQ

CSS to SASS Converter

Convert CSS to Sass’s indented syntax: no braces or semicolons, nesting by indentation, and pseudo-classes written as &:hover.

Input CSS
Output SASS
Ready.

How to use the CSS to SASS 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 Sass output follows your edits.
  3. Review the nested Sass and add variables or mixins where values repeat.
  4. Use Copy or Download above the output panel to take the Sass file with you.

What the CSS to SASS converter produces

Sass's original syntax, used in .sass files, has no braces and no semicolons; indentation alone defines which declarations belong to which selector. Unlike SCSS, plain CSS is not valid indented Sass, so a conversion is required. This CSS to SASS converter parses your CSS, nests rules under their shared parent selector, and prints them with 2-space indentation, property: value lines and no punctuation at line ends.

Example

.nav{display:flex}.nav a{color:#333}.nav a:hover{color:#0f766e}h1,h2{margin:0}
.nav
  display: flex
  a
    color: #333
    &:hover
      color: #0f766e

h1, h2
  margin: 0

.nav a became an indented a under .nav, the hover rule became &:hover one level deeper, and the selector list h1, h2 stayed on a single line.

Indented syntax details to know

CSSIndented Sass output
a { color: red; }a followed by an indented color: red
Multi-line /* comment */A single-line /* comment */, since the indented syntax is line-based
Empty rule .x {}.x with a /* empty */ placeholder, because a selector needs an indented body
@import url(...);@import url(...) without the semicolon

Indentation must be consistent in the whole file. The converter uses 2 spaces; if you edit by hand, avoid mixing in tabs.

After converting

You can now add Sass features using the indented shorthand: $brand: #0f766e for variables, =mixin-name to define a mixin and +mixin-name to include it. Check the result with the SASS Compiler; it should produce CSS equivalent to your original. If your team prefers braces, CSS to SCSS gives the same nesting in SCSS syntax.

Mistakes that break a .sass file

  • Adding semicolons back. A line such as color: red; is a syntax error in the indented syntax. Leave line ends bare.
  • Mixing tabs and spaces. Sass rejects a file whose indentation is inconsistent, even if it looks aligned in your editor. Configure the editor to insert spaces for .sass files.
  • Putting a declaration on the selector line. .nav display: flex is not valid; the property must go on its own indented line below the selector.
  • Splitting a selector list carelessly. A long list may span several lines only if every line except the last ends with a comma.

The indented syntax also accepts the longer @mixin and @include keywords, so you can keep those spellings if your team finds = and + too terse.

Why choose the indented syntax?

Teams pick .sass files mostly for brevity: without braces and semicolons a stylesheet is noticeably shorter, and the structure is visible from indentation alone, which suits people who already write Pug, Haml, Slim or Python. The trade-off is that you cannot paste CSS snippets from documentation or browser tools straight in; they need converting first, which is exactly what this page is for. Both syntaxes compile with the same Dart Sass compiler and can import each other, so a project can adopt the indented style gradually.

Limitations

  • Compound selectors such as .btn.active are not nested under .btn.
  • @keyframes and @font-face are converted to indented form without nesting.
  • Syntax errors in the input CSS, such as a missing closing brace, stop the conversion and are reported.

Conversion happens entirely in your browser.

Frequently asked questions

Why can’t I just rename my .css file to .sass?
The indented syntax does not accept braces or semicolons, so plain CSS is not valid .sass. Renaming works for .scss, which is a superset of CSS.
Why are my multi-line comments on one line now?
The indented syntax is line-based, so the converter joins comment lines into a single /* */ comment to keep the file valid.
What indentation does the output use?
Two spaces per level. Keep indentation consistent if you edit the file; tabs and spaces cannot be mixed.
Can I convert the result back to CSS?
Yes. Paste it into the SASS Compiler or the SASS to CSS converter to get plain CSS again.

Last updated September 26, 2026

Related tools