math.min($number...) returns the lowest of one or more numbers. Arguments must have compatible units or all be unitless. Units on the winning value are kept. Load it with @use "sass:math" (Dart Sass 1.23+ for modules; global min() also exists).
Official samples.
math.min(1px, 4px) → 1px · math.min(50px, 30px, 100px) via list spread → 30px.
Compile-time minimum.
Sass writes a fixed number into CSS. For fluid values like min(10vw, 2rem), leave CSS min() in the stylesheet.
Prefer the module form.
Global min() still works for older stylesheets. New code should use math.min after @use "sass:math" so the helper clearly comes from the math module.
Syntax
Syntax
SCSS
@use "sass:math";
math.min($number...); //=> number
math.min(1px, 4px); // 1px
$widths: 50px, 30px, 100px;
math.min($widths...); // 30px
math.min(3, 9, 1); // 1
// Global name (legacy)
min(1px, 4px); // 1px
// Module API — prefer math.min after @use "sass:math"
Pattern: collect comparable tokens → call math.min (optionally with list spread) → emit the winning length. Pair with math.max and math.clamp.
Reference
Units and Lists
How arguments behave:
Call
Result
math.min(1px, 4px)
1px
math.min($widths...) with 50px, 30px, 100px
30px
math.min(3, 9, 1)
1
math.min(-2px, -8px, -1px)
-8px (most negative)
Incompatible units (e.g. px/em)
Compile error
List spread.
Official docs show spreading a list with $widths... so you can store candidates in one variable.
One line: when several Sass numbers must collapse to the smallest, call math.min($number...).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:math"
2. Pass comparable numbers (or spread a list)
3. Expect the lowest value with its units
4. Prefer math.min over bare min() in new code
5. Use CSS min() when values must stay fluid
Frequently Asked Questions
math.min($number...) returns the lowest of one or more Sass numbers. For example math.min(1px, 4px) is 1px. Arguments need compatible units (or all be unitless).
Add @use "sass:math"; then call math.min(...) with one or more numbers. You can also spread a list: math.min($widths...).
Yes. The global min($number...) name still works for older stylesheets. New projects should prefer math.min() from sass:math so the helper clearly comes from the math module.
Same idea, different stage. Sass math.min() runs at compile time and writes a fixed number. CSS min() stays in the stylesheet and can mix lengths like min(10vw, 2rem) in the browser.
If the numbers cannot be compared (for example 10px and 2em), Sass raises a compile error. Keep arguments in a compatible unit family or all unitless. Check with math.compatible().
Yes. Put the values in a list and spread it with ... — for example math.min($widths...) where $widths is 50px, 30px, 100px.