JavaScript Math.asin() Method

Definition
Math.asin(x) returns the arc sine (inverse sine) of a number. It answers: which angle has this sine? The angle is in radians, from -π/2 to π/2.
Math is built into JavaScript. Call the method directly. It is not a constructor, so never write new Math().
Syntax
Call Math.asin() like this. Start with this line.
| Call | What it does |
|---|
Math.asin(x) | Returns the arc sine of x, in radians. |
Built into JavaScript. Call Math.asin() on the Math object — no import required.
Library declarations
interface Math {
asin(x: number): number;
}
Parameters
| Parameter | Description |
|---|
| x | Required. A number from -1 to 1. Numbers outside this range return NaN. |
Return Value
| Return Value | Description |
|---|
| number | The angle in radians, from -π/2 to π/2. Returns NaN if x is below -1 or above 1. |
JavaScript Examples
Example 1 — Basic Use
Pass a number from -1 to 1. You get an angle in radians.
console.log(Math.asin(0)); // 0
console.log(Math.asin(0.5)); // 0.5235987755982989
console.log(Math.asin(1)); // 1.5707963267948966
console.log(Math.asin(-1)); // -1.5707963267948966
console.log(Math.asin(2)); // NaN
0
0.5235987755982989
1.5707963267948966
-1.5707963267948966
NaN
How It Works
- Sine 0. The angle with sine
0 is 0. - Sine 1.
Math.asin(1) is about 1.5708, which is π / 2 (90 degrees). - Negative input.
-1 gives -π / 2, a negative angle. - Out of range.
2 is not a valid sine, so you get NaN.
Example 2 — Radians to Degrees
Convert the radians result to degrees with a small helper.
function toDegrees(radians) {
return radians * 180 / Math.PI;
}
var angle = Math.asin(0.5);
console.log(angle); // 0.5235987755982989
console.log(toDegrees(angle).toFixed(1)); // 30.0
console.log(toDegrees(Math.asin(1))); // 90
0.5235987755982989
30.0
90
How It Works
- Get radians.
Math.asin(0.5) is about 0.5236 radians. - Convert.
radians * 180 / Math.PI gives degrees. - Round.
toFixed(1) shows a clean 30.0.
Example 3 — Angle in a Right Triangle
The sine is the opposite side divided by the hypotenuse. Use Math.asin() to find the angle.
var opposite = 5;
var hypotenuse = 10;
var ratio = opposite / hypotenuse;
var radians = Math.asin(ratio);
var degrees = radians * 180 / Math.PI;
console.log(ratio); // 0.5
console.log(degrees.toFixed(1)); // 30.0
How It Works
- Make the ratio.
5 / 10 is 0.5. This is the sine of the angle. - Apply asin.
Math.asin(0.5) returns the angle in radians. - Convert. The angle is 30 degrees.
Compatibility
Browser & Runtime Support
Math.asin() has been part of JavaScript since ES1 and is Baseline Widely available everywhere.
✓ Baseline · ES1
Math.asin()
Supported in every browser and Node.js version. No polyfill is needed.
99% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full supportMath.asin Excellent
Bottom line: Use Math.asin() freely. It works in all browsers and runtimes.
Frequently Asked Questions
Math.asin(x) returns the angle, in radians, whose sine is x. For example, Math.asin(1) is about 1.5708, which is 90 degrees.
No. It returns radians. Multiply by 180 / Math.PI to convert to degrees.
A sine is always between -1 and 1, so no angle has a sine of 2. The result is NaN.
The result is between -Math.PI / 2 and Math.PI / 2 (about -1.5708 to 1.5708).
Math.sin(angle) takes an angle and returns a ratio. Math.asin(ratio) takes a ratio and returns the angle.
About the author
Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
11 people found this page helpful