math.sqrt($number) returns the square root of $number. The argument must be unitless. Negative inputs return NaN. Load it with @use "sass:math" on Dart Sass 1.25+.
No CSS units on input — reattach lengths after the call.
Negatives → NaN; prefer math.sqrt over math.pow($n, 0.5).
Dart Sass 1.25+ via @use "sass:math".
One line: when a unitless ratio must become a fixed square root in CSS, call math.sqrt($number).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:math"
2. Pass a unitless number (use math.div for ratios)
3. Expect a unitless root (or NaN for negatives)
4. Multiply by a length when you need CSS sizes
5. Use CSS sqrt() for runtime values
Frequently Asked Questions
math.sqrt($number) returns the square root of a unitless number. Example: math.sqrt(100) is 10; math.sqrt(math.div(1, 3)) is about 0.5773502692.
Add @use "sass:math"; then call math.sqrt($number). Requires Dart Sass 1.25+.
No. Official docs require $number to be unitless. Strip units with a ratio first, or multiply the result by a length afterward—for example 16px * math.sqrt(2).
math.sqrt(-1) returns NaN. Dart Sass may serialize that as calc(NaN) in CSS. Avoid negatives unless you intentionally handle NaN.
math.sqrt($n) is the clear square-root form of math.pow($n, 0.5). math.hypot(a, b) is √(a² + b²) and can keep compatible length units; sqrt alone needs unitless input.
Official docs expose this as math.sqrt() on sass:math. Prefer the module form with @use "sass:math".