A calculation is the Sass value type for CSS math functions: calc(), clamp(), min(), and max(). Sass parses what is inside, simplifies it as far as it can, and writes the result back as CSS.
If every part has compatible units, the calculation collapses into an ordinary number. If it cannot (for example 100% - 20px), you keep a calculation value that serializes as calc(...).
Official idea.
calc(400px + 10px) becomes 410px, but calc(400px + 10%) stays a calculation because px and % cannot be added at compile time.
SassScript inside.
Variables, function calls, nested calculations, and interpolation all work inside a calculation. Write calc(100% - $gap) without #{}.
Operators stop at the edge.
You cannot apply Sass operators (*, +, …) to an unsimplified calculation. Wrap the math in another calc(), or use a meta function to inspect it.
Pattern: write the CSS math function → let Sass substitute variables and simplify → keep any unsimplified result inside another calc() if you need to scale it.
Reference
Calculation Rules
What you can and cannot do:
Case
Result
Why
calc(400px + 10px)
410px
Compatible units collapse to a number
calc(400px + 10%)
calc(400px + 10%)
Different unit types stay a calculation
calc(100% - $gap)
calc(100% - 16px)
Variables are substituted
$calc * 2
Error
Sass operators cannot touch a calculation
calc($calc * 2)
calc((…) * 2)
Wrap the math in another calculation
calc(pi), calc(e)
Numbers
Constants resolve to numbers
calc(infinity), calc(NaN)
Stay as calc(...)
Written back as CSS constants
Inspecting calculations.
Use meta.calc-name() and meta.calc-args() to read the name and arguments of an unsimplified calculation. meta.type-of() returns calculation.
Calculations are the value type for calc(), clamp(), min(), and max().
Compatible units simplify to plain numbers; others stay as CSS.
No Sass operators on unsimplified calculations—nest inside calc().
Constantspi and e resolve to numbers inside calculations.
One line: let Sass simplify calculations, and keep unsimplified math inside calc().
Practice
Compile Notes
Practical checklist:
checklist.txt
1. Write calc() / clamp() / min() / max() as in CSS
2. Use $variables directly inside calculations
3. Expect compatible units to collapse to numbers
4. Never apply Sass operators to an unsimplified calculation
5. Use meta.calc-name() / calc-args() to inspect one
Frequently Asked Questions
A calculation is the value type for CSS math functions calc(), clamp(), min(), and max(). Sass simplifies the contents when it can and otherwise writes the calculation to CSS.
When every operand has compatible units, such as calc(400px + 10px), Sass computes the result and returns a plain number like 410px.
An unsimplified calculation is not a number, so Sass operators cannot be applied to it. Use calc($calc * 2) instead.
Yes. Write calc(100% - $gap) directly. Interpolation with #{} also works but is usually not needed.
Yes. calc(pi) and calc(e) resolve to numbers. infinity, -infinity, and NaN are kept as CSS calc() expressions.
min() is the CSS calculation function that can stay in the output. math.min() is a Sass function that always returns a number at compile time.