Sass math.sin()

Beginner
9 min read
Updated: Nov 2026
5 examples
Dart Sass 1.25+

Definition and Usage

math.sin($number) returns the sine of $number. Pass an angle whose units are compatible with deg, or a unitless number treated as radians. The result is a unitless ratio (typically between -1 and 1). Load it with @use "sass:math" on Dart Sass 1.25+.

Official samples.

math.sin(100deg) → 0.984807753 · math.sin(1rad) → 0.8414709848 · math.sin(1) → 0.8414709848.

Compile-time sine.

Sass writes a fixed number into CSS. For dynamic angles (custom properties, animations), prefer CSS sin() in supporting browsers.

Unitless means radians.

math.sin(1) is not “1 degree” — it matches math.sin(1rad). Pass deg explicitly when you think in degrees.

Syntax

SCSS
@use "sass:math";

math.sin($number); //=> unitless number

math.sin(100deg); // 0.984807753
math.sin(1rad);   // 0.8414709848
math.sin(1);      // 0.8414709848  (unitless = radians)

math.sin(0deg);   // 0
math.sin(90deg);  // 1

// Module API — prefer math.sin after @use "sass:math"

Pattern: choose an angle unit → call math.sin → multiply by a length when you need CSS offsets. Pair with math.cos, math.tan, and math.asin.

Angles and Units

How inputs are interpreted:

InputMeaningExample result
100degDegrees0.984807753
1radRadians0.8414709848
1 (unitless)Treated as radians0.8414709848
0degSine of zero0
30degFamiliar half0.5
90degSine of right angle1
180degSine of half-turn0
Lengths like pxNot an angleError
Result is not an angle.

Sine is a unitless ratio. Need a length? Multiply: $r * math.sin(30deg).

SCSS Examples

Examples target Dart Sass 1.25+ with @use "sass:math". Open View Compiled CSS for verified output (matches official Sass docs samples).

Example 1 — Official Docs Sample (Degrees)

Sine of 100deg is a large positive ratio.

SCSS
@use "sass:math";

@debug math.sin(100deg); // 0.984807753

.basic {
  --deg: #{math.sin(100deg)};
}

How It Works

  1. Input is 100deg — an angle unit.
  2. Sine returns a unitless number.
  3. Value is positive in the second quadrant.
  4. Matches the official Sass docs sample.

Example 2 — Radians and Unitless

Official samples: 1rad and unitless 1 match.

SCSS
@use "sass:math";

@debug math.sin(1rad); // 0.8414709848
@debug math.sin(1);    // 0.8414709848

.rad {
  --rad: #{math.sin(1rad)};
  --unitless: #{math.sin(1)};
}

How It Works

  1. 1rad is one radian.
  2. Unitless 1 is treated the same way.
  3. Both compile to 0.8414709848.
  4. Do not confuse unitless input with degrees.

Example 3 — Cardinal Angles

Familiar sines for 0°, 30°, 90°, and 180°.

SCSS
@use "sass:math";

.angles {
  --zero: #{math.sin(0deg)};
  --thirty: #{math.sin(30deg)};
  --ninety: #{math.sin(90deg)};
  --one-eighty: #{math.sin(180deg)};
}

How It Works

  1. sin(0deg) → 0.
  2. sin(30deg) → 0.5.
  3. sin(90deg) → 1.
  4. sin(180deg) → 0.

Example 4 — Round-Trip with math.asin

asin undoes sin for angles in the asin range.

SCSS
@use "sass:math";

.roundtrip {
  --back: #{math.asin(math.sin(30deg))};
  --ratio: #{math.sin(math.asin(0.5))};
}

How It Works

  1. sin(30deg) is 0.5.
  2. asin(0.5) returns 30deg.
  3. asin range is -90deg…90deg — other angles may not round-trip the same way.
  4. Use math.asin when you need the inverse.

Example 5 — Emit a Fixed CSS Ratio

Store a compile-time sine for opacity or scale helpers.

SCSS
@use "sass:math";

$angle: 100deg;

.wave {
  --s: #{math.sin($angle)};
  opacity: math.sin(90deg);
}

How It Works

  1. Angle token is resolved at compile time.
  2. Custom property receives the unitless sine.
  3. opacity: 1 comes from sin(90deg).
  4. Keep CSS sin() when the angle must stay dynamic.

Edge Cases & Pitfalls

Most sin bugs are treating unitless input as degrees, or expecting an angle back.

rad

Unitless = radians

math.sin(90) is not one. Write 90deg when you mean degrees.

return

Result is unitless

Multiply by a length for CSS offsets. Sine itself is not deg.

stage

Compile time, not runtime

Sass cannot sin a live CSS custom property. Leave CSS sin() in the stylesheet for that.

module

Module-only helper

Use math.sin after @use "sass:math".

Sass Support

Prefer the module form with Dart Sass 1.25+.

APIStatus
math.sin()Dart Sass 1.25+ via @use "sass:math"
InputAngle (deg-compatible) or unitless radians
Return typeUnitless number
LibSass / Ruby SassNo modern sass:math sin

Compile with the Dart Sass CLI.

Key Takeaways

  • Returns sine as a unitless ratio from an angle.
  • Unitless input = radians; prefer explicit deg when needed.
  • Compile-time — CSS gets a fixed number.
  • Dart Sass 1.25+ via @use "sass:math".

One line: when an angle must become a fixed sine ratio in CSS, call math.sin($number).

Compile Notes

Practical checklist:

checklist.txt
1. @use "sass:math"
2. Pass deg-compatible angle or unitless radians
3. Expect a unitless ratio (about -1…1)
4. Multiply by a length when you need CSS offsets
5. Use CSS sin() for runtime angles

Frequently Asked Questions

math.sin($number) returns the sine of an angle. Example: math.sin(100deg) is about 0.984807753; math.sin(1rad) and math.sin(1) are about 0.8414709848.
Add @use "sass:math"; then call math.sin($number). Requires Dart Sass 1.25+.
An angle compatible with deg (such as deg, rad, turn, grad), or a unitless number. Unitless values are treated as radians.
No. Sine is a unitless ratio (typically between -1 and 1). Multiply by a length if you need a CSS length, for example $r * math.sin(30deg).
Sass math.sin() runs at compile time and writes a fixed number. CSS sin() stays in the stylesheet and can use runtime values like custom properties in supporting browsers.
Official docs expose this as math.sin() on sass:math. Prefer the module form with @use "sass:math".

Next: Sass math.sqrt()

Take the square root of a unitless number at compile time.

math.sqrt() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful