math.radians(x) converts an angle x from degrees to radians using x * (pi / 180) and returns a float.
Every trigonometric function in Python's math module (math.sin(), math.cos(), math.tan()) expects radians, so call math.radians() whenever your inputs start in degrees.
math.radians() is a function in Python's standard math module: import it with import math and call math.radians(...), or import the name directly with from math import radians.
Syntax
Import math and pass an angle in degrees.
python
import math
rad = math.radians(angle_degrees)
Call
What it does
math.radians(180)
Returns 3.141592653589793 (math.pi).
math.radians(90)
Returns approximately 1.570796... (pi / 2).
math.radians(0)
Returns 0.0.
math.radians(-45)
Returns approximately -0.785398... (-pi / 4).
Converts proportionally without wrapping: math.radians(720) gives 2 * math.tau. Use math.degrees() to convert back.
Function signatures
python
math.radians(x, /)
# returns: float angle in radians (x * pi / 180)
Parameters
Parameter
Description
x
Required positional angle in degrees (int or float).
Return Value
Return Value
Description
float
Equivalent angle in radians; returns inf, -inf, or nan for special floats.
Python Examples
Example 1 — Feed Degree Measurements Into sin() and cos()
Convert common compass degrees to radians and evaluate cosine and sine side by side.
python
import math
for deg in [0, 45, 90, 180]:
r = math.radians(deg)
c, s = math.cos(r), math.sin(r)
print(
f"{deg:>3} deg | rad={r:.4f} | "
f"cos={c:+.4f} | sin={s:+.4f}"
)