math.min() is a bounding helper in the sass:math module. It returns the lowest of one or more numbers and keeps compatible CSS units. You will learn module loading, list spreading with ..., how it differs from CSS min(), and five compiled examples.
01
Concept
Lowest value
02
Module
@use "sass:math"
03
Args
One or more numbers
04
Spread
$list...
05
Vs CSS
min()
06
Practice
5 examples
Concept
What Is math.min()?
math.min() compares its arguments and returns the smallest one. That is useful when several tokens or calculations compete and you want the tightest value baked into CSS.
math.min(1px, 4px) → 1px
math.min(50px, 30px, 100px) → 30px
math.min($widths...) → lowest item in the list
Pair it with math.max() when you need the largest value, or with math.clamp() when you need both a floor and a ceiling around one preferred number.
💡
Beginner tip
Browsers never see math.min. Dart Sass evaluates it and writes only the winning number into your .css file.
Foundation
📝 Syntax
Load the math module, then pass one or more numbers:
Incompatible units — px vs em fails; keep a shared family.
Expecting fluid CSS — Sass min cannot mix vw the way CSS min can.
Confusing with clamp — min picks a winner among candidates; clamp bounds one preferred value.
LibSass pipelines — prefer Dart Sass for the module API.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:math" and math.min() in new SCSS
Keep arguments in a compatible unit family
Spread lists with $list... for generated values
Use CSS min() when viewport math is required
Prefer Dart Sass for built-in modules
❌ Don’t
Expect the browser to re-evaluate math.min
Mix relative and absolute units carelessly
Replace CSS fluid min() with Sass when %/vw is involved
Use min when you really need a min–max corridor (clamp)
Rely on LibSass for sass:math
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about math.min()
Compile-time lowest value—compatible units required.
5
Core concepts
📝01
Call
math.min(...)
API
📦02
Module
sass:math
@use
▼03
Result
lowest
Min
📏04
Units
compatible
Rule
⚡05
When
compile time
Sass
❓ 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 two 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.
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.
Yes. Put the values in a list and spread it with ... — for example math.min($widths...) where $widths is 50px, 30px, 100px.
Did you know?
Official Sass docs place math.min under Bounding Functions next to max, clamp, ceil, floor, and round. Min and max are mirrors: one returns the trough, the other the peak.
math.min() picks the lowest comparable number at compile time. Spread lists when you need to, keep units compatible, and switch to CSS min() when the candidates must stay fluid with the viewport.