DEV Community

Cover image for Radians to Degrees Conversion: Formula, Examples, and Programming Basics
UnitMorph
UnitMorph

Posted on

Radians to Degrees Conversion: Formula, Examples, and Programming Basics

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 / π
Enter fullscreen mode Exit fullscreen mode

For example, if the radian value is 2:

degrees = 2 × 180 / π
Enter fullscreen mode Exit fullscreen mode

The result is approximately:

114.5916°
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

If you want a rounded result:

function radiansToDegrees(radians) {
  return Number((radians * 180 / Math.PI).toFixed(4));
}

console.log(radiansToDegrees(2));
// 114.5916
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

returns approximately:

1
Enter fullscreen mode Exit fullscreen mode

because Math.PI / 2 represents 90 degrees.

If you instead pass 90 directly:

Math.sin(90)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 / π
Enter fullscreen mode Exit fullscreen mode

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)