You can use a function like this to do the conversion:

function toDegrees (angle) {
  return angle * (180 / Math.PI);
}

Note that functions like sin, cos, and so on do not return angles, they take angles as input. It seems to me that it would be more useful to you to have a function that converts a degree input to radians, like this:

function toRadians (angle) {
  return angle * (Math.PI / 180);
}

which you could use to do something like tan(toRadians(45)).

Answer from Peter Olson on Stack Overflow
🌐
Math.js
mathjs.org › docs › reference › functions › sin.html
math.js
To avoid confusion with the matrix sine, this function does not apply to matrices. ... math.sin(2) // returns number 0.9092974268256813 math.sin(math.pi / 4) // returns number 0.7071067811865475 math.sin(math.unit(90, 'deg')) // returns number 1 math.sin(math.unit(30, 'deg')) // returns number 0.5 const angle = 0.2 math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number 1
🌐
W3Schools
w3schools.com › jsref › jsref_sin.asp
JavaScript Math sin() Method
cssText getPropertyPriority() getPropertyValue() item() length parentRule removeProperty() setProperty() JS Conversion ... Math.sin(x) expect x in radians. To use degrees, convert degrees to radians first.
🌐
W3Schools
w3schools.com › js › js_math.asp
JavaScript Math Object
Math.sin(x) returns the sine (a value between -1 and 1) of the angle x (given in radians). If you want to use degrees instead of radians, you have to convert degrees to radians:
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math › sin
Math.sin() - JavaScript | MDN - Mozilla
December 29, 2025 - function getCircleY(radians, radius) { return Math.sin(radians) * radius; } console.log(getCircleY(1, 10)); // Expected output: 8.414709848078965 console.log(getCircleY(2, 10)); // Expected output: 9.092974268256818 console.log(getCircleY(Math.PI, 10)); // Expected output: 1.2246467991473533e-15
🌐
Dirask
dirask.com › posts › JavaScript-Math-sin-in-degrees-Z1AwNp
JavaScript - Math.sin in degrees
// ONLINE-RUNNER:browser; function calculateSine(degrees) { var radians = (Math.PI / 180) * degrees; return Math.sin(radians); } // Example: console.log( calculateSine(0) ); // 0 console.log( calculateSine(30) ); // ~0.5 console.log( ...
🌐
Programiz
programiz.com › javascript › library › math › sin
JavaScript Math sin()
The sin() method computes the trigonometric sine of the specified angle and returns it.
🌐
TechOnTheNet
techonthenet.com › js › math_sin.php
JavaScript: Math sin() function
In JavaScript, the syntax for the sin() function is: ... The number used to calculate the sine. It is the value of an angle expressed in radians. The sin() function returns the sine of a number. To convert degrees to radians, multiply by 2π/360 or 0.017453293.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-math-sin-method
JavaScript Math sin() Method - GeeksforGeeks
July 15, 2024 - The Math.sin() method returns the sine of the given numbers between 1 and -1.
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Math › sin
JavaScript Math sin() - Calculate Sine Value | Vultr Docs
September 27, 2024 - This code converts 90 degrees to radians and calculates its sine, which famously results in 1. Embed Math.sin() within a custom function to compute sine for various angles.
🌐
p5.js
p5js.org › reference › p5 › sin
sin
The values returned oscillate between -1 and 1 as the input angle increases. sin() calculates the sine of an angle, using radians by default, or according to if angleMode() setting (RADIANS or DEGREES).
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math
Math - JavaScript - MDN Web Docs
Math.trunc() Returns the integer portion of the input, removing any fractional digits. The trigonometric functions sin(), cos(), tan(), asin(), acos(), atan(), and atan2() expect (and return) angles in radians. Since humans tend to think in degrees, and some functions (such as CSS transforms) can accept degrees, it is a good idea to keep functions handy that convert between the two: js ·
🌐
Dirask
dirask.com › posts › JavaScript-Math-sin-method-example-3D78np
JavaScript - Math.sin() method example
// ONLINE-RUNNER:browser; function calculateSin(degrees) { var radians = (Math.PI / 180) * degrees; return Math.sin(radians); } // Example: var x1 = 0.0; // beginning of calculation in degrees var x2 = 90.0; // ending of calculation degrees ...
🌐
Educative
educative.io › answers › what-is-mathsin-in-javascript
What is Math.sin() in JavaScript?
Number: It returns the sine of the given angle stored in param. It is of Number type. Its range is: ... NaN: The function returns NaN if param is positive or negative Infinity. To convert degrees to radians, use the following formula.
🌐
W3Schools
w3schools.com › jsref › jsref_cos.asp
JavaScript Math cos() Method
Math.cos(x) expects x radians. To use degrees, convert the degrees to radians. Math.cos(degree * Math.PI / 180); Try it Yourself » · The Math.cos() method returns the cosine of a number.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math › cos
Math.cos() - JavaScript | MDN - Mozilla
December 29, 2025 - Math.cos(-Infinity); // NaN Math.cos(-0); // 1 Math.cos(0); // 1 Math.cos(1); // 0.5403023058681398 Math.cos(Math.PI); // -1 Math.cos(2 * Math.PI); // 1 Math.cos(Infinity); // NaN
🌐
Baeldung
baeldung.com › home › algorithms › using math.sin with degrees
Using Math.sin with Degrees | Baeldung
January 25, 2024 - @Test public void givenAnAngleInDegrees_whenUsingToRadians_thenResultIsInRadians() { double angleInDegrees = 30; double sinForDegrees = Math.sin(Math.toRadians(angleInDegrees)); // 0.5 double thirtyDegreesInRadians = 1/6 * Math.PI; double sinForRadians = Math.sin(thirtyDegreesInRadians); // 0.5 assertTrue(sinForDegrees == sinForRadians); } Since thirtyDegreesInRadians was already in radians, we didn’t need to first convert it to get the same result. In this quick article, we’ve reviewed radians and degrees and then saw an example of how to work with them using Math.sin.