Favorites

JavaScript Math.sin() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Math.sin()
JavaScript Math Static methodThis method is supported by all modern browsers.
Updated 28th November 2026

The Math.sin() static method returns the sine of an angle given in radians.

Description

The Math.sin() static method returns the sine of an angle in radians. It's used for circular motion, waves and smooth oscillating animations. Because of floating point precision, Math.sin(Math.PI) is a tiny number rather than exactly 0.

To position a point on a circle, combine it with Math.cos(): x = cx + r * Math.cos(angle) and y = cy + r * Math.sin(angle). Using a growing value such as elapsed time as the angle gives a smooth wave, which is useful for bobbing or pulsing animations.

Remember that the argument must be in radians, so convert degrees with deg * Math.PI / 180. The inverse function, Math.asin(), returns the angle for a given sine. Like every member of Math, it's called on the Math object itself rather than on a number, and it only works with the Number type: passing a BigInt throws a TypeError.

Syntax

Math.sin(x)

Parameters

  • xAn angle in radians.

Return Value

The sine of the angle, from -1 to 1.

Example

console.log(Math.sin(Math.PI / 2));
console.log(Math.sin(Math.PI));
for (let i = 0; i <= 4; i++) {
  console.log(i, (Math.sin(i * Math.PI / 4)).toFixed(2));
}

Browser Support

The following information will show you the current browser support for the Math.sin() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee