If you work with trigonometric functions in programming, you will often encounter radians instead of degrees. Most programming languages and mathematical libraries expect angles in radians for functions such as sine, cosine, and tangent.
That can become confusing when your input or output is easier to understand in degrees.
Fortunately, converting radians to degrees requires only a simple formula:
Degrees = Radians × 180 ÷ π
The key relationship to remember is:
π radians = 180°
If you need to convert values quickly without doing the calculation manually, you can use the free Radians to Degrees Converter.
Radians vs. Degrees
Both radians and degrees measure angles, but they use different scales.
A full circle contains:
360° = 2π radians
Therefore:
- 90° = π/2 radians
- 180° = π radians
- 270° = 3π/2 radians
- 360° = 2π radians
One radian is approximately:
1 radian ≈ 57.2958°
Radians are particularly useful in programming and mathematics because they work naturally with circular measurements and trigonometric functions.
Radians to Degrees Formula
The standard conversion formula is:
degrees = radians × 180 / π
For example, if the radian value is 2:
degrees = 2 × 180 / π
The result is approximately:
114.5916°
So:
2 radians ≈ 114.5916 degrees
Simple Programming Example
If you're implementing the conversion yourself, the logic is straightforward.
In JavaScript:
function radiansToDegrees(radians) {
return radians * 180 / Math.PI;
}
console.log(radiansToDegrees(2));
// 114.59155902616465
If you want a rounded result:
function radiansToDegrees(radians) {
return Number((radians * 180 / Math.PI).toFixed(4));
}
console.log(radiansToDegrees(2));
// 114.5916
The same mathematical concept applies regardless of the programming language. The important part is using the language's value of π rather than manually entering a rounded value whenever possible.
Common Radian Values
Here are some useful reference values:
| Radians | Degrees |
|---|---|
| 0 | 0° |
| 0.1 | 5.7296° |
| 0.5 | 28.6479° |
| 1 | 57.2958° |
| 1.5 | 85.9437° |
| 2 | 114.5916° |
| 3 | 171.8873° |
| π/2 | 90° |
| π | 180° |
| 2π | 360° |
Why Programming Libraries Use Radians
Many programming environments use radians for trigonometric calculations.
For example, JavaScript's built-in Math.sin(), Math.cos(), and Math.tan() functions expect their input in radians.
That means this:
Math.sin(Math.PI / 2)
returns approximately:
1
because Math.PI / 2 represents 90 degrees.
If you instead pass 90 directly:
Math.sin(90)
JavaScript interprets 90 as 90 radians, not 90 degrees.
This is a common source of bugs when working with angles.
If your application receives angles in degrees, convert them to radians before passing them to trigonometric functions.
The reverse conversion is useful when you receive a result in radians but need to display it to users in degrees.
Degrees to Radians
The reverse conversion is just as simple:
Radians = Degrees × π ÷ 180
For example:
90° × π ÷ 180 = π/2 radians
So the two formulas are:
Radians → Degrees
degrees = radians × 180 / π
Degrees → Radians
radians = degrees × π / 180
Keeping both formulas available can help prevent mistakes when moving between user-facing values and internal calculations.
Where This Conversion Is Useful
Radian-to-degree conversion appears in many programming-related areas, including:
- Game development
- 2D and 3D graphics
- Animation
- Robotics
- Physics simulations
- Geographic calculations
- Data visualization
- Engineering software
- Mathematical applications
For example, a graphics application may calculate rotation internally using radians but display an object's rotation to the user as degrees.
Use a Converter for Quick Checks
When working with a few values, manually applying the formula is easy. But when checking multiple calculations, an online converter can be useful for quickly verifying your results.
The UnitMorph Radians to Degrees Converter lets you enter a radian value and get its equivalent in degrees.
UnitMorph also provides a collection of free online conversion tools at unitmorph.com for different types of measurements.
Final Takeaway
The main formula is simple:
Degrees = Radians × 180 / π
Remember:
π radians = 180°
For programming, the most important thing is to remember that many trigonometric functions expect radians. If your application works with degrees, convert the value before using those functions.
Once you understand the relationship between radians and degrees, switching between the two becomes straightforward.
Top comments (0)