math.asin() is an inverse trigonometric helper in the sass:math module. Given a sine factor, it returns the matching angle in deg. You will learn the unitless input rule, NaNdeg behavior, pairing with math.sin, Dart Sass 1.25+ notes, and five compiled examples.
01
Concept
Arcsine
02
Module
@use "sass:math"
03
Input
Unitless (−1…1)
04
Output
Angle in deg
05
Since
Dart Sass 1.25+
06
Practice
5 examples
Concept
What Is math.asin()?
Arcsine answers: which angle has this sine? In Sass the answer is always an angle in degrees:
Official docs place it under Trigonometric Functions next to math.sin(), math.acos(), and math.atan. Use asin when you already have a unitless sine factor and need the angle back.
💡
Beginner tip
Browsers never see math.asin. Dart Sass evaluates it and writes a plain angle (like 30deg) into your .css file—or NaNdeg if the input was invalid.
Foundation
📝 Syntax
Load the math module, then pass a unitless number:
styles.scss
@use "sass:math";
math.asin($number)
// $number must be unitless → result is in deg
Parameters
Parameter
Type
Required
Description
$number
Number
Yes
Sine factor. Must be unitless. Valid domain is typically -1 to 1.
Return value
Type
Situation
Result
Angle
Input in −1…1
Arcsine in deg (−90deg…90deg)
Angle
Input outside −1…1
NaNdeg (as in the official docs)
Error
Argument has units
Compile fails—pass a unitless factor
Modules
📦 Loading sass:math
styles.scss
// Recommended — namespaced
@use "sass:math";
$a: math.asin(0.5);
// Optional — bring members into the current namespace
@use "sass:math" as *;
$a: asin(0.5);
// Optional — custom namespace
@use "sass:math" as m;
$a: m.asin(0.5);
⚠️
Put @use first
Keep @use "sass:math"; near the top of the file. math.asin() needs Dart Sass 1.25+.
Numbers
📏 How Units Work
Unlike math.sin() (which takes an angle), math.asin() takes a unitless factor and returns deg.
Call
Result
Notes
math.asin(0.5)
30deg
Official example
math.asin(2)
NaNdeg
Official out-of-range example
math.asin(0)
0deg
Sine of 0°
math.asin(1)
90deg
Sine of 90°
math.asin(-1)
-90deg
Sine of −90°
math.asin(0.5px)
—
Error: must be unitless
Support
🛠 Compatibility
This is about Sass compilers, not browsers. Compiled CSS receives a plain angle (or NaNdeg).
Implementation
math.asin()
Notes
Dart Sass 1.25+
Yes
Preferred; needs @use "sass:math"
Dart Sass < 1.25
No
Upgrade Dart Sass
LibSass / Ruby Sass
No module API
Use Dart Sass for trigonometric helpers
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import math
@use "sass:math";
Angle from sine
math.asin(0.5) → 30deg
Out of range
math.asin(2) → NaNdeg
Clamp before asin
math.asin(math.clamp(-1, $n, 1))
Round-trip with sin
math.sin(math.asin(0.5)) ≈ 0.5
Debug while learning
@debug math.asin(0.5);
Compare
📋 asin vs sin vs acos
Function
Direction
Best for
math.asin($n)
Factor → angle (deg)
Recovering an angle from a sine factor
math.sin($angle)
Angle → unitless factor
Vertical projection / circular Y
math.acos($n)
Factor → angle (deg)
Recovering an angle from a cosine factor
Prefer math.asin when the known value is a sine-like ratio. Prefer math.sin when you already know the angle. Note the ranges: asin spans −90deg…90deg; acos spans 0deg…180deg.
Compare
📋 Sass math.asin() vs CSS / JS asin
Sass math.asin()
CSS asin() / JS Math.asin
When it runs
Compile time (Dart Sass)
In the browser / runtime
Result unit
Always deg
JS returns radians; CSS follows CSS angle rules
Appears in CSS output?
No — only the angle result
CSS asin() can stay in the stylesheet
Best for
Fixed factors known in SCSS
Dynamic factors / animated values
Hands-On
Examples Gallery
Each example uses @use "sass:math". Open View Compiled CSS to see what Dart Sass emits.
📚 Getting Started
Official-style asin calls and landmark values.
Example 1 — Basic math.asin()
Official docs example: arcsine of 0.5 is 30 degrees.
math.asin() turns a unitless sine factor into a compile-time angle in deg (−90°…90°). Keep inputs in −1…1 (clamp when needed), pair with math.sin for round-trips, and watch for NaNdeg on invalid values.