ThisCalculator

Everyday

Python Convert Degrees to Radians

Updated · Standard formula, shown below

Radians 3.1416 rad
Degrees
180 °
You entered

Python Convert Degrees to Radians

To convert degrees to radians in Python, multiply the degree value by math.pi / 180 or use the built-in math.radians() function. Both return the angle in radians as a float, ready for use in trigonometric calculations.

Formula

The conversion formula is:

radians = degrees × (π / 180)

Where:

  • degrees – the angle in degrees (°)
  • radians – the angle in radians (rad), the SI unit for angles
  • π (pi) – approximately 3.141592653589793

This formula comes from the fact that a full circle is 360° and also 2π radians, so 360° = 2π rad, which simplifies to 1° = π/180 rad.

Worked Example

Using the default value of 180 degrees:

  1. Start with the formula: radians = degrees × (π / 180)
  2. Plug in 180 degrees: radians = 180 × (π / 180)
  3. The 180 in the numerator cancels with the 180 in the denominator, leaving radians = π
  4. Numerically, π ≈ 3.1416 radians

The calculator above returns 3.1416 rad, matching the expected result.

Why Convert Degrees to Radians in Python?

Python’s math module trigonometric functions (sin(), cos(), tan(), asin(), etc.) expect angles in radians, not degrees. If you feed them degrees, you’ll get incorrect results. For example, math.sin(90) returns 0.8939967 (the sine of 90 radians), not 1.0. Converting to radians first ensures your calculations are correct.

Radians are also the natural unit in mathematics, simplifying many formulas in calculus and physics. When working with data that uses degrees (like geographic coordinates or angles from user input), converting to radians is a necessary step before performing trigonometric operations.

Methods to Convert Degrees to Radians

There are three common approaches:

  • Using math.radians() – the simplest and most readable: math.radians(180) returns 3.141592653589793.
  • Manual multiplication – degrees * math.pi / 180 gives the same result, useful if you want to avoid importing the whole module.
  • Using numpy.deg2rad() – for arrays: np.deg2rad([0, 90, 180]) returns array([0., 1.5708, 3.1416]).

For a single value, math.radians() is recommended for clarity. For lists or arrays, numpy.deg2rad() is more efficient.

Common Mistakes and Pitfalls

One frequent error is forgetting that math.radians() returns a float. If you need an integer, you must round or cast it explicitly. Another mistake is using the degree symbol in a numeric literal – Python doesn’t recognize the ° symbol, so always use a plain number.

Also, be careful with the order of operations: degrees * math.pi / 180 is correct, but degrees / 180 * math.pi is also fine. The result is the same because multiplication and division are left-associative. However, degrees * (math.pi / 180) is explicit and avoids any confusion.

For very large or very small angles, floating-point precision can cause tiny errors. For example, math.radians(180) gives 3.141592653589793, which is π accurate to 15 decimal places. This is usually sufficient, but if you need exact rational multiples of π, consider using symbolic libraries like sympy.

How to Choose the Right Method

Consider the following when selecting a conversion method:

  • Single value – use math.radians().
  • List/array – use numpy.deg2rad() for speed and vectorized operations.
  • No imports – multiply by pi / 180 manually (you still need math.pi unless you define your own constant).
  • Symbolic exactness – use sympy.rad() to get an exact symbolic expression.

In most data science and engineering applications, math.radians() is perfectly adequate. For performance-critical code processing large arrays, numpy.deg2rad() is the standard choice.

Alternatives and Related Conversions

If you need to convert radians back to degrees, use math.degrees() or multiply by 180 / math.pi. For converting between degrees and other angular units like gradians, the factor is different (1° = 10/9 grads). Python’s math module doesn’t have a direct function for grads, but you can convert via degrees.

For geographic coordinates, note that latitude and longitude are often given in degrees, minutes, and seconds (DMS). To convert DMS to decimal degrees, use the formula: decimal = degrees + minutes/60 + seconds/3600. Then you can convert to radians as usual.

Frequently Asked Questions

What is the difference between math.radians() and numpy.deg2rad()?

math.radians() works on a single number and returns a Python float. numpy.deg2rad() works element-wise on arrays, returning a NumPy array. For a scalar, both give the same result, but numpy is faster for large datasets.

How do I convert degrees to radians without importing math?

You can use the constant pi = 3.141592653589793 and multiply: radians = degrees * pi / 180. However, you still need to define pi yourself, which is error-prone. Importing math is recommended.

Why does math.sin(90) return 0.8939 instead of 1?

Because math.sin() expects radians. 90 radians is not 90 degrees. To get the sine of 90 degrees, use math.sin(math.radians(90)), which returns 1.0.

Can I use degrees directly in Python’s trigonometric functions?

No, the standard math functions require radians. However, you can use math.sin() with the math.radians() conversion, or use the sind() and cosd() functions available in some third-party libraries like numpy (e.g., np.sind(90)), but these are not part of the standard library.

What is the value of 1 radian in degrees?

1 radian is approximately 57.2958 degrees. This comes from the formula: degrees = radians × (180 / π).

Is there a performance difference between the methods?

For a single value, the difference is negligible. For arrays, numpy.deg2rad() is much faster because it uses vectorized operations in C. If performance matters and you have large arrays, use numpy.

Related

Formula used
in deg | Degrees | ° | 180 | 0
out rad | Radians | rad | deg * pi / 180 | 4

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.