ENGINE MATH
Angle Converter
Convert between degrees, radians, gradians, and turns — with the nearest game direction.
ROTATION MATH
Convert an angle
| Unit | Value | |
|---|---|---|
Angle conversion guide
Game code is a tangle of angle units: degrees in the editor, radians in math functions, gradians in some engines, and "turns" in shader code. This converter translates between all four and shows the nearest 8-way direction — the reference every developer ends up searching for mid-project.
The conversion that trips everyone
Radians are the only unit math functions accept: Math.sin, Math.cos, and most engine APIs take radians. Degrees are what designers and editor fields use. The conversion is simple — radians = degrees × π/180 — but it is so easy to get backwards that "degree to radian" is a permanent search query.
Turns (or "revolutions") are common in shaders and animation systems: 1 turn = 360° = 2π rad. Gradians (400 to a circle) appear in surveying tools and a few European-engineered systems — rarely in games, but you will meet them eventually.
Which unit should your code use?
Keep angles in radians internally for all math, and convert only at the edges: when reading designer input (degrees) and when displaying debug values. Storing degrees and converting every frame is a classic source of drift bugs — a 0.0001° rounding error becomes visible rotation over time.
Tip: Never compare angles with ==. Always diff and wrap: ((a − b + π) mod 2π) − π gives the shortest signed difference, which is what you want for turning toward a target.
Frequently asked questions
How do I convert degrees to radians?
Multiply by π/180. 45° = 0.7854 rad, 90° = 1.5708 rad, 180° = 3.1416 rad. This tool does it instantly.
Why do math functions want radians?
Radians make calculus identities clean (derivative of sin is cos without scale factors). It is a math convention every language inherited — you cannot avoid it, only convert around it.
What is a turn?
One full revolution: 360° = 2π rad = 1 turn. Useful in shaders and animation where wrapping naturally happens at 1.0.
Privacy note: angle conversions happen in your browser. Nothing is uploaded.