Advertisement

Arctan2 (atan2) Calculator

Compute atan2(y, x): the angle of a point or vector in degrees and radians, in both −180° to 180° and 0° to 360° form, with quadrant and distance from the origin.

atan2(y, x) gives the direction of the point (x, y), or of a vector with those components, measured from the positive x-axis. Unlike plain arctan(y/x), it looks at the signs of both coordinates, so it tells all four quadrants apart and still works when x = 0. Programmers use it for headings, joystick angles, bearings and converting to polar coordinates.

How to use this tool

  1. Enter the y component (vertical) first, then the x component (horizontal).
  2. Read the angle in degrees from -180° to 180°, the range atan2 returns.
  3. Use the 0° to 360° value if you need a full-turn direction.
  4. Check the quadrant and the distance r to get the full polar form (r, θ).

Formula

θ = atan2(y, x), the angle with cos θ = x / r and sin θ = y / r, where r = √(x² + y²)

For x > 0, atan2(y, x) = arctan(y / x). For x < 0 it adds 180° when y ≥ 0 and subtracts 180° when y < 0. On the y-axis it gives ±90°. The result lies in (-180°, 180°]; add 360° to negative answers for the 0° to 360° form.

Example

For the point (-4, 3), arctan(3 / -4) alone gives -36.8699°, which points into quadrant IV, the wrong way. atan2(3, -4) corrects for the negative x and returns 143.1301° (2.498092 rad), in quadrant II. The point is r = √(16 + 9) = 5 units from the origin.

Frequently asked questions

Why not just use arctan(y / x)?

Dividing loses the signs: (3, -4) and (-3, 4) give the same ratio. arctan also fails when x = 0. atan2 keeps both signs and covers the full circle.

Why does Excel give a different answer?

Excel and Google Sheets take the arguments in the order ATAN2(x, y), the reverse of most programming languages. Swap the inputs and the results match.

What is atan2(0, 0)?

Mathematically it is undefined because the origin has no direction. Many languages return 0 by convention; this calculator shows a message instead.

How do I get a compass bearing?

Compass bearings start at north and run clockwise. Use bearing = (90° − θ) mod 360°, where θ is the 0° to 360° angle from this calculator.

Last updated: 2026-10-30

Advertisement