Sass string operators build strings at compile time. The main tool is + for concatenation. You will also see the legacy binary -, historical unary / and -, quote rules, and why interpolation is often clearer—plus five compiled examples.
01
Concat
+
02
Quotes
Quoted / unquoted
03
Legacy
Binary -
04
Unary
/ & -
05
Prefer
#{} interpolation
06
Practice
5 examples
Concept
What Are String Operators?
Official docs: Sass supports a few operators that generate strings. They run when Sass compiles—not in the browser.
+ joins two values into one string.
Binary - joins with a hyphen (legacy—prefer interpolation).
Unary / and - prefix a value (historical).
They work with more than strings: booleans, times, and other CSS-writable values.
Numbers and colors cannot be the left-hand value of +.
💡
Beginner tip
For most new code, write #{$family} #{$weight} or #{$prefix}-#{$name} instead of chaining operators. Official docs say interpolation is often cleaner and clearer.
Both values in one string (quoted if either side is quoted)
- (binary)
legacy hyphen join
Unquoted string with - between the values
/ (unary)
historical prefix
Unquoted string starting with /
- (unary)
historical prefix
Unquoted string starting with -
Official samples
Expression
Result
"Helvetica" + " Neue"
"Helvetica Neue"
sans- + serif
sans-serif (unquoted)
sans - serif
sans-serif (legacy)
Quotes
❛ Quoted vs Unquoted Results
Official docs: if either value is a quoted string, the result will be quoted; otherwise, it will be unquoted.
Left
Right
Result style
Quoted
Quoted / unquoted / other
Quoted string
Unquoted
Quoted
Quoted string
Unquoted
Unquoted
Unquoted string
Use meta.inspect() while learning—it shows quote marks clearly in the compiled custom property.
Mix
📦 Not Just Strings
Official docs: these operators can be used with any values that can be written to CSS, with a few exceptions.
Numbers cannot be the left-hand value (they have numeric operators).
Colors cannot be the left-hand value (they used to have their own operators).
Putting the string on the left is the safe pattern: "Elapsed time: " + 10s.
Expression
Result
"Elapsed time: " + 10s
"Elapsed time: 10s"
true + " is a boolean value"
"true is a boolean value"
Legacy
⚠️ Legacy Binary -
Official docs: binary - returns an unquoted string that contains both expressions’ values, separated by -. It is a legacy operator—interpolation should generally be used instead.
Font stacks — join family tokens before emitting CSS.
Debug labels — "Elapsed: " + $duration in comments or custom props.
BEM-style names — #{$block}__#{$element} via interpolation.
🧠 How Compilation Works
1
Write a join
Use +, legacy -, or #{} interpolation.
Source
2
Build a Sass string
Apply quote rules and convert CSS-writable values to text.
Compile
3
Place into CSS
Emit as a value, selector piece, or property name.
Emit
4
✓
CSS ships
Browsers only see finished text like .theme-dark.
Watch Out
⚠️ Common Pitfalls
Number on the left — 10s + " left" is not string concat.
Color on the left — put the string first instead.
Legacy - — prefer #{$a}-#{$b}.
Quote surprises — one quoted side makes the whole + result quoted.
Confusing with math — numeric +/- win when numbers lead.
Pro Tips
💡 Best Practices
✅ Do
Prefer #{} interpolation for selectors and names
Use + when you truly need one concatenated string
Keep a string on the left when mixing types
Inspect quote state with meta.inspect
Reach for string.quote / string.unquote when needed
❌ Don’t
Rely on legacy binary - in new code
Put numbers or colors on the left of string +
Overuse unary / and - prefixes
Expect browsers to concatenate Sass strings
Forget that quotes affect the + result type
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Sass string operators
Build strings at compile time—and prefer interpolation for clarity.
5
Core concepts
📝01
Main op
+ concatenates
Call
❛02
Quotes
either side quoted
Rule
⚠️03
Legacy
binary -
Avoid
✨04
Prefer
#{} interpolation
Modern
✓05
Left side
string first
Habit
❓ Frequently Asked Questions
Operators that build strings at compile time. The main one is + for concatenation. There is also a legacy binary - that joins values with a hyphen, plus historical unary / and -.
Official docs: if either value is a quoted string, the result is quoted; otherwise it is unquoted. Example: "Helvetica" + " Neue" is quoted; sans- + serif is unquoted.
Generally no. Official docs call binary - a legacy operator and recommend interpolation instead, such as #{$a}-#{$b}.
Yes, with most CSS-writable values. Numbers and colors cannot be the left-hand value because they have (or used to have) their own operators. Example: "Elapsed time: " + 10s works.
For historical reasons, / value returns an unquoted string starting with /, and - value returns an unquoted string starting with -. Example: / 15px → /15px, - moz → -moz.
Often yes. Official docs say it is often cleaner and clearer to use interpolation (#{$value}) to create strings rather than relying on these operators.
Did you know?
Official Sass docs recommend interpolation over string operators for clarity—even though "Helvetica" + " Neue" still works perfectly for quoted concatenation.
Sass string operators—especially +—build text at compile time. Know the quote rules, treat binary - as legacy, and reach for #{} interpolation when clarity matters most.