Sass math.asin()

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

Definition and Usage

math.asin($number) returns the arcsine of $number in deg. $number must be unitless. Load it with @use "sass:math" on Dart Sass 1.25+.

Official samples.

math.asin(0.5) → 30deg. math.asin(2) is out of range (docs show NaNdeg; current Dart Sass emits calc(NaN * 1deg)).

Inverse of sine.

Valid results sit between -90deg and 90deg. Pair with math.sin for round-trips. Compare with math.acos (0…180deg).

Unitless input only.

Do not pass px, %, or deg into math.asin. Feed a plain sine ratio (about -1 to 1).

Syntax

SCSS
@use "sass:math";

math.asin($number); //=> angle in deg

math.asin(0.5);  // 30deg
math.asin(1);    // 90deg
math.asin(0);    // 0deg
math.asin(-0.5); // -30deg
math.asin(-1);   // -90deg
math.asin(2);    // NaN angle (out of range)

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

Pattern: compute a sine ratio → math.asin for a signed CSS angle → compare with math.acos / math.atan when the geometry differs.

Domain and Range

Keep the sine domain in mind before calling asin:

InputResult
math.asin(1)90deg
math.asin(0.5)30deg
math.asin(0)0deg
math.asin(-0.5)-30deg
math.asin(-1)-90deg
|x| > 1NaN angle (invalid sine)
Input with unitsError — must be unitless
Signed angles.

Unlike math.acos, arcsine preserves sign: negative ratios become negative degrees.

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

Arcsine of 0.5 is a 30° angle.

SCSS
@use "sass:math";

@debug math.asin(0.5); // 30deg

.basic {
  --half: #{math.asin(0.5)};
}

How It Works

  1. Unitless 0.5 is a valid sine value.
  2. Result is 30deg, not radians.
  3. Ready for CSS properties that take angles.
  4. Matches the official Sass docs sample.

Example 2 — Endpoints and Signs

Map 1, 0, and negative ratios to classic angles.

SCSS
@use "sass:math";

.range {
  --one: #{math.asin(1)};
  --zero: #{math.asin(0)};
  --neg-half: #{math.asin(-0.5)};
  --neg: #{math.asin(-1)};
}

How It Works

  1. asin(1) → 90deg.
  2. asin(0) → 0deg.
  3. Negative inputs yield negative degrees.
  4. Range is -90…90deg for real results.

Example 3 — Out-of-Range Input

Sine never exceeds 1, so 2 is invalid.

SCSS
@use "sass:math";

@debug math.asin(2); // NaN angle (docs: NaNdeg)

.nan {
  --bad: #{math.asin(2)};
}

How It Works

  1. |x| > 1 is outside the sine domain.
  2. Official docs label the result NaNdeg.
  3. Current Dart Sass serializes it as calc(NaN * 1deg).
  4. Clamp or guard inputs before calling asin in real themes.

Example 4 — Round-Trip with math.sin

asin and sin undo each other for valid values.

SCSS
@use "sass:math";

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

How It Works

  1. sin(asin(0.5)) recovers 0.5.
  2. asin(sin(30deg)) recovers 30deg.
  3. acos(0.5) is 60deg — a different inverse.
  4. Pick asin vs acos based on which trig ratio you have.

Example 5 — Emit a CSS Rotation

Turn a sine ratio into a concrete rotate() angle.

SCSS
@use "sass:math";

$sin: 0.5;

.angle {
  --deg: #{math.asin($sin)};
  transform: rotate(math.asin($sin));
}

How It Works

  1. Store the ratio in a variable when reusing it.
  2. Sass compiles the angle before CSS sees it.
  3. transform receives plain 30deg.
  4. Useful for geometry helpers in design systems.

Edge Cases & Pitfalls

Most asin bugs are feeding units, or skipping the −1…1 domain check.

units

Input must be unitless

math.asin(0.5deg) or math.asin(0.5px) fails. Pass a plain number.

domain

Clamp before calling

If a ratio can drift past ±1 from rounding, clamp it first (for example with math.clamp(-1, $x, 1)).

nan

NaN serialization

Docs say NaNdeg; modern Dart Sass may emit calc(NaN * 1deg). Treat both as invalid angles.

range

asin ≠ acos range

asin returns -90…90deg; acos returns 0…180deg. Same ratio can mean different angles.

Sass Support

Prefer the module form with Dart Sass 1.25+.

APIStatus
math.asin()Dart Sass 1.25+ via @use "sass:math"
InputUnitless number
Return typeAngle in deg (or NaN angle)
LibSass / Ruby SassNo modern sass:math asin

Compile with the Dart Sass CLI.

Key Takeaways

  • Returns arcsine in deg from a unitless sine ratio.
  • Valid domain is -1…1; range is -90deg…90deg.
  • Pairs with math.sin for inverse trigonometry.
  • Dart Sass 1.25+ via @use "sass:math".

One line: when a unitless sine ratio must become a CSS angle, call math.asin($number).

Compile Notes

Practical checklist:

checklist.txt
1. @use "sass:math"
2. Pass a unitless ratio in -1…1
3. Expect a deg angle (-90deg…90deg)
4. Clamp noisy inputs before asin
5. Use math.sin for the forward transform

Frequently Asked Questions

math.asin($number) returns the arcsine of a unitless number in degrees. Example: math.asin(0.5) is 30deg. Values outside -1…1 are not a real angle; current Dart Sass emits calc(NaN * 1deg) for those.
Add @use "sass:math"; then call math.asin($number). Requires Dart Sass 1.25+.
A unitless number, typically between -1 and 1 (the range of sine). Lengths like px or angles like deg are not allowed as input.
An angle in deg. For valid inputs the result is between -90deg and 90deg. Out-of-range inputs produce a NaN angle (serialized as calc(NaN * 1deg) in modern Dart Sass).
They are inverse ideas: math.sin(math.asin(0.5)) recovers 0.5, and math.asin(math.sin(30deg)) recovers 30deg (within floating-point precision).
Official docs expose this as math.asin() on sass:math. Prefer the module form with @use "sass:math".

Next: Sass math.atan()

Return the arctangent of a unitless number in degrees.

math.atan() →

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