Degrees to Radians Converter

°

Enter any angle — positive, negative, or decimal

Quick pick

Conversion Formula

radians = degrees × (π / 180)

180° × (π / 180) = 3.141593 rad

Radian Value

3.141593

= π rad

From 180°

In Gradians

200 gon

Full Rotations

0.5

sin(180°)

0

cos(180°)

-1

Inverse

3.141593 rad = 180°

Unit Circle — Your Angle Highlighted

90°180°270°180°

Common Degree-to-Radian Conversions

DegreesExact (π)Decimal (rad)
00
30°π/60.5236
45°π/40.7854
60°π/31.0472
90°π/21.5708
120°2π/32.0944
135°3π/42.3562
150°5π/62.618
180°π3.1416
270°3π/24.7124
360°6.2832

How to Use This Tool

  1. 1.Enter the angle in degrees in the input field — use negative values or decimals like −45 or 22.5
  2. 2.Read the radian result instantly — both the decimal value and the exact π fraction (when available)
  3. 3.Use the quick-pick buttons for common angles like 30°, 45°, 90°, or 180°
  4. 4.Check the unit circle diagram to see your angle visually, along with sin and cos values
  5. 5.Click any row in the reference table to load that angle into the converter

Rate this tool

Degrees to Radians for Developers: CSS Transforms, Canvas, and Game Engines

Degrees to radians conversion hits you the moment you call ctx.rotate() on an HTML Canvas and your 90° rotation does something insane. The Canvas API, WebGL, and every trig function in JavaScript expect radians — but designers, config files, and user inputs speak degrees. Multiply by π/180 and the mismatch vanishes. This guide focuses on the practical developer side: where radians show up in web APIs, how game engines handle angles, and the edge cases that ship bugs to production.

Unit circle diagram showing degree-to-radian conversions at key angles including 30°, 45°, 60°, 90°, 180°, and 360° with their exact radian equivalents labeled along the circumference

The Degrees-to-Radians Formula

One line:

radians = degrees × (π / 180)

A full circle is 360° and 2π radians. Divide: 2π / 360 = π/180 ≈ 0.017453 radians per degree. Multiply any degree value by this constant. For the reverse operation — radians back to degrees — flip the fraction to 180/π. Our radians to degrees converter covers that direction with physics examples.

CSS Transforms: deg vs rad vs turn

CSS supports four angle units out of the box: deg, rad, grad, and turn. You can write any of these:

  • transform: rotate(90deg)
  • transform: rotate(1.5708rad)
  • transform: rotate(0.25turn)

All three produce identical results. In practice, hardcoded CSS uses degfor readability. But when you generate styles from JavaScript — say, pointing an arrow toward the user's cursor — the math produces radians via Math.atan2(). Instead of converting back to degrees, you can inject the radian value directly:

element.style.transform = `rotate(${radians}rad)`;

One fewer conversion, one fewer place for bugs. The turn unit is useful for loading spinners: rotate(1turn) is a full revolution — cleaner than typing 360deg or 6.2832rad.

Canvas 2D API: Why arc() and rotate() Need Radians

The Canvas 2D specification inherited its angle convention from PostScript and OpenGL — both radian-native. Two methods trip developers up most often:

ctx.arc(x, y, r, startAngle, endAngle)— draws a circular arc. To draw a semicircle, you pass 0 and Math.PI (not 0 and 180). A full circle: 0 to 2 * Math.PI. Passing 360 instead of 2π draws an arc spanning 360 radians — roughly 57 full circles — which the browser clips to one revolution, but it's technically wrong and can cause rendering glitches in some engines.

ctx.rotate(angle) — rotates the entire canvas coordinate system by angleradians. If an artist says "rotate the sprite 45°," your code needs ctx.rotate(45 * Math.PI / 180). Forgetting the conversion rotates by 45 radians instead — about 7.16 full spins — leaving the sprite in a seemingly random orientation.

WebGL Rotation Matrices in Practice

WebGL has no built-in rotation function. You build rotation matrices yourself (or use a library like gl-matrix). A 2D rotation matrix looks like this:

[cos(θ), -sin(θ), 0, 0,
 sin(θ),  cos(θ), 0, 0,
 0,       0,      1, 0,
 0,       0,      0, 1]

θ must be in radians because Math.cos() and Math.sin() expect radians. The gl-matrix library's mat4.rotateZ(out, a, rad)takes radians explicitly. Three.js's object.rotation.z also stores radians, though its MathUtils.degToRad() helper exists specifically because so many developers pass degrees by mistake.

Angle Conventions Across Game Engines

Not every engine agrees. Here's the landscape:

Engine / LibraryInput UnitNotes
Canvas 2DRadiansarc(), rotate(), all angles
WebGL / gl-matrixRadiansRotation matrices, shader uniforms
Three.jsRadiansHas MathUtils.degToRad() helper
PixiJSRadianssprite.rotation in rad
Unity (C#)DegreesTransform.Rotate() uses degrees; Mathf.Deg2Rad for conversion
Unreal (C++)DegreesFRotator uses degrees; FMath::DegreesToRadians() when needed
GodotRadiansdeg_to_rad() built-in; inspector shows degrees
CSSAnyAccepts deg, rad, grad, turn

The pattern: low-level APIs (Canvas, WebGL, OpenGL) use radians. High-level engines (Unity, Unreal) use degrees for the inspector and convert internally. If you're porting code between engines, the angle convention is the first thing to check.

Building a Reusable Conversion Helper

Rather than typing * Math.PI / 180 everywhere, wrap it once:

  • JavaScript / TypeScript: const toRad = (deg: number) => deg * (Math.PI / 180);
  • Python: from math import radians — Python already ships one
  • C#: float rad = deg * Mathf.Deg2Rad; (Unity) or deg * MathF.PI / 180f (vanilla .NET)
  • Rust: let rad = deg.to_radians(); — built into f64

The helper isn't just about saving keystrokes. It makes code self-documenting: toRad(heading) is immediately clear; heading * 0.017453isn't. And if you ever need to swap to a lookup table for performance (unlikely but it happens in shader-adjacent code), you change one function.

Edge Cases in Animation Loops

Animations that accumulate rotation over time hit two gotchas.

Overflow past 2π.A spinning loader adding 2° per frame reaches 360° after 180 frames (3 seconds at 60 fps). In radians, that's 2π ≈ 6.2832. After 10 minutes, the accumulated value is ~37,700 rad. JavaScript handles this fine numerically, but some physics engines or collision systems behave erratically with large angles. Normalize periodically: angle = angle % (2 * Math.PI).

Interpolating between 350° and 10°. A naive lerp goes the long way around (350 → 180 → 10). The fix: convert both to radians, compute the shortest angular difference using atan2(sin(b-a), cos(b-a)), then interpolate. This trick — sometimes called "angular lerp" — is essential for smooth turret tracking, compass needles, and camera follow systems.

Unit Circle Quick Reference

The eight angles you'll convert most often in code, with their exact radian values and trig outputs:

DegreesRadianssincosCommon use case
001Default / east-facing
30°π/60.50.866Isometric projection angle
45°π/40.7070.707Diagonal movement / miter cut
90°π/210Right angle / north-facing
180°π0−1Flip / U-turn
270°3π/2−10South-facing / dropdown arrow
360°01Full revolution / spinner

For angles between these landmarks, the conversion helper is faster than memorization. But knowing that π/2 ≈ 1.5708 and π ≈ 3.1416 lets you sanity-check results instantly — if your rotation function returns 47.12 for a 270° input, something's wrong.

Working with GPS coordinates in DMS format? That's a two-step pipeline: DMS → decimal degrees → radians. Common in geolocation code where the Haversine formula needs radian inputs to calculate distances between points on Earth.

Marko Sinko
Marko SinkoTechnical Tools Editor

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Marko builds and verifies the technical tools, number system converters, and scientific calculators across UnitCalcTools, ensuring mathematical precision and developer-friendly interfaces.

Last updated: April 13, 2026LinkedIn

Frequently Asked Questions

The Canvas 2D spec inherited its angle convention from PostScript and OpenGL, both radian-native. Passing 180 to ctx.arc() draws an arc spanning 180 radians (about 28.6 full circles), not a semicircle. You need Math.PI for a semicircle and 2 * Math.PI for a full circle. This catches roughly 1 in 3 developers the first time they use the API.
90 degrees equals exactly π/2 radians, approximately 1.5708. This is a quarter turn — a right angle. In Canvas API calls like ctx.arc(), you'd pass Math.PI / 2 for a 90° arc. It's the most commonly converted angle in frontend code because right-angle rotations appear in nav menus, icon animations, and chart drawing.
Both store rotation in radians, but Three.js provides MathUtils.degToRad() as a built-in helper while PixiJS has no equivalent — you must multiply by Math.PI / 180 yourself. In Three.js, object.rotation.z = MathUtils.degToRad(45) rotates 45°. In PixiJS, sprite.rotation = 45 * Math.PI / 180 achieves the same. Godot also uses radians natively but offers deg_to_rad() in GDScript.
You get the wrong answer silently — no error is thrown. Math.sin(45) treats 45 as radians (about 2,578°) and returns 0.8509 instead of the expected 0.7071. This is the single most common angle bug in JavaScript. Always wrap degree values: Math.sin(45 * Math.PI / 180).
Yes. CSS supports deg, rad, grad, and turn. One turn equals 360° or 2π radians. For loading spinners, rotate(1turn) is cleaner than rotate(6.2832rad). However, when generating CSS transforms from JavaScript atan2() output, injecting the radian value directly as rotate(Xrad) avoids an extra conversion step.
A naive lerp goes the long way around (350 → 180 → 10 = 340° of travel). Convert both angles to radians, compute the shortest difference with atan2(sin(b-a), cos(b-a)), then interpolate along that arc. This angular lerp technique is essential for turret tracking, compass needles, and camera-follow systems. The radian conversion makes the atan2 call possible.
No. WebGL has zero built-in rotation functions — you construct rotation matrices manually using cos(θ) and sin(θ), which expect radians. Libraries like gl-matrix (mat4.rotateZ) also take radians. Passing a degree value to a rotation matrix produces wildly wrong geometry. Three.js wraps this for you, but raw WebGL never does.

Related Tools