The Sass @else rule is the optional fallback after an @if. Its block runs only when the preceding @if expression is falsey.
Write @if <expr> { … } @else { … }. Exactly one of the two branches is evaluated at compile time. Browsers never see @else — only the styles from the branch that ran.
Official pattern.
Per the Sass docs: follow @if with @else { … } when you need a clear alternate path for falsey conditions (themes, flags, binary variants).
@else vs @else if.
@else has no extra condition. For more tested branches, see @else if.
Truthiness.
Only false and null are falsey in Sass. Empty strings, empty lists, and 0 are truthy.
Most @else bugs are orphaned rules, truthiness surprises, or overlapping @if blocks.
pair
@else needs @if
@else must follow an @if (or @else if chain). Alone it is a compile error.
truthy
0 and empty strings are truthy
Unlike some languages, Sass treats 0, "", and empty lists as truthy. Only false and null take the @else path.
exclusive
Prefer @else over a second @if
Two separate @if blocks can both run. Use @else when outcomes are mutually exclusive.
chain
Need more tests? Use @else if
A plain @else cannot check another expression. Chain with @else if, then end with @else.
Toolchain
Sass Support
@else is a core Dart Sass control rule. It is not a browser CSS feature — support means your Sass compiler understands it.
Implementation
Status
Dart Sass
Supported (recommended)
LibSass / node-sass
Supported (deprecated toolchain)
Ruby Sass
Supported (end-of-life)
Browsers
N/A — only see compiled CSS
Prefer Dart Sass for new projects. SCSS and indented syntax both support @else.
Remember
Key Takeaways
Pair:@else always follows @if.
Fallback: runs when the @if expression is falsey.
Exclusive: exactly one branch emits CSS.
More tests: use @else if, then a final @else.
One line:@else is the compile-time “otherwise” after @if.
Compile
Compile Notes
@else never reaches the browser. Conceptual flow:
flow.txt
1. Evaluate the @if expression
2. If truthy → run the @if block; skip @else
3. If falsey → skip @if; run the @else block
4. Final stylesheet contains only that branch’s CSS
Frequently Asked Questions
An @else block follows an @if and runs only when that @if expression is falsey. It is the alternate branch of a two-way compile-time choice.
No. @else must immediately follow an @if (or an @else if chain). It is not a standalone at-rule.
In a simple @if / @else pair, exactly one block is evaluated: the @if block if the condition is truthy, otherwise the @else block.
No. @else is the final fallback with no extra condition. @else if adds another tested condition and is covered on a separate page.
No. Like @if, it is compile-time only. Browsers see only the styles from the branch that ran.
Only false and null are falsey. Empty strings, empty lists, and 0 are truthy in Sass.