HomeMath › Spherical Coordinates Calculator

Spherical Coordinates Calculator

Convert between rectangular (x, y, z) and spherical (r, θ, φ) coordinates. Pick a direction, then enter the three values to get r, the polar angle θ and the azimuth φ in degrees and radians (physics ISO convention).

Example: with Direction Rectangular → Spherical (x, y, z) · x (or r) 1 · y (or θ in degrees) 1 · z (or φ in degrees) 1 → Radial r / x: r = 1.7321.

  • Polar θ / yθ = 54.7356° (0.9553 rad)
  • Azimuth φ / zφ = 45° (0.7854 rad)

Computed by the calculator below using its default values. Change any input to see your own numbers.

Radial r / x
Polar θ / y
Azimuth φ / z

Physics/ISO convention: r is distance from the origin, θ is the polar angle down from the +z axis (0 to 180 degrees), and φ is the azimuth around the +z axis measured from +x. Many calculus texts swap the θ and φ labels.

Three numbers for a point in space

Spherical coordinates locate a point by how far it is and which way it faces. r is the straight-line distance from the origin. The polar angle θ measures how far the direction tips down from the +z axis, running from 0 at the north pole to 180 degrees at the south. The azimuth φ spins around the vertical axis, measured from the +x direction like a compass bearing.

Converting from rectangular is direct: r is the magnitude √(x²+y²+z²), θ is acos(z/r), and φ is atan2(y, x). Going the other way, x = r sinθ cosφ, y = r sinθ sinφ, and z = r cosθ. The only trouble spot is the origin, where every direction is equally valid and the angles are undefined.

Two conventions, one warning

Physics and engineering (the ISO 80000-2 standard) use θ for the polar angle and φ for the azimuth, which is what this tool does. Many US calculus textbooks reverse the letters, calling the azimuth θ and the polar angle φ, and often write the radius as ρ. The math is identical; only the names differ, so always confirm which convention a problem uses before plugging in.

How it’s calculated

Physics/ISO 80000-2 convention. Rectangular to spherical: r = √(x²+y²+z²), θ = acos(z/r) in [0°, 180°], φ = atan2(y, x) in (-180°, 180°]. Spherical to rectangular: x = r sinθ cosφ, y = r sinθ sinφ, z = r cosθ. Angles are entered and shown in degrees, with radians alongside.

At the origin (r = 0) the angles are undefined and reported as 0. The math convention that swaps θ and φ (and uses ρ for radius) gives the same point under different labels.

Rectangular and spherical (physics convention)

(x, y, z)rθ (polar)φ (azimuth)
(1, 1, 1)1.73254.74°45°
(0, 0, 5)5
(1, 0, 0)190°
(0, 1, 0)190°90°
(0, 0, -3)3180°

Computed with r = √(x²+y²+z²), θ = acos(z/r), φ = atan2(y, x).

Common mistakes

  • Swapping θ and φ because a textbook uses the opposite convention.
  • Using atan(y/x) instead of atan2(y, x), which loses the correct quadrant for φ.
  • Measuring the polar angle θ up from the xy-plane instead of down from the +z axis.
  • Mixing degrees and radians between the angle inputs and a trig function.

Frequently asked questions

How do you convert rectangular to spherical coordinates?

Use r = √(x²+y²+z²), θ = acos(z/r) for the polar angle, and φ = atan2(y, x) for the azimuth. This tool reports θ and φ in both degrees and radians.

What is the difference between the physics and math conventions?

Physics (ISO) uses θ for the polar angle and φ for the azimuth. Many calculus books swap them and write the radius as ρ. The point is the same; only the labels change. This tool uses the physics convention.

What are the formulas from spherical back to rectangular?

x = r sinθ cosφ, y = r sinθ sinφ, z = r cosθ, with θ the polar angle from +z and φ the azimuth from +x.

Why are the angles undefined at the origin?

When r = 0 the point sits at the origin, so no direction is singled out. Both θ and φ can be anything, and the tool reports 0.