What this converter does
This tool converts a point given in 3D Cartesian coordinates (x, y, z) into spherical coordinates (r, theta, phi). It is a pure-mathematics tool that works for any real input values and lets you choose whether the two angles are reported in degrees or radians.
The convention used here
Follow this page's convention exactly, as it can differ from other textbooks. Here r is the radial distance from the origin, theta is the azimuthal angle measured in the x-y plane from the positive x-axis, and phi is the polar (inclination) angle measured down from the positive z-axis.
The formulas
$$r = \sqrt{x^2 + y^2 + z^2}$$ The angles use the two-argument arctangent for robustness: $$\theta = \operatorname{atan2}(y,\, x) \quad\text{and}\quad \varphi = \operatorname{atan2}\!\left(\sqrt{x^2 + y^2},\, z\right)$$ Using \(\operatorname{atan2}\) instead of the naive \(\arctan(y/x)\) avoids division-by-zero and keeps the correct quadrant. All trig results are in radians; when "Degrees" is selected, each angle is multiplied by \(\frac{180}{\pi}\).
How to use it
Enter the x, y and z components of your point, pick the output angle unit, and read off r, theta and phi. r is independent of the chosen angle unit.
Worked example
For \(x = 3\), \(y = 4\), \(z = 5\) in degrees: $$r = \sqrt{9 + 16 + 25} = \sqrt{50} = 7.071068$$ $$\theta = \operatorname{atan2}(4, 3) = 0.927295 \text{ rad} = 53.130102^\circ$$ With \(\sqrt{x^2+y^2} = \sqrt{25} = 5\), $$\varphi = \operatorname{atan2}(5, 5) = \arctan(1) = 0.785398 \text{ rad} = 45^\circ$$
Common Points and Their Spherical Coordinates
This page uses \(r=\sqrt{x^2+y^2+z^2}\), \(\theta=\operatorname{atan2}(y,x)\) (azimuth, measured in the xy-plane from the +x axis) and \(\varphi=\operatorname{atan2}\left(\sqrt{x^2+y^2},\,z\right)\) (polar angle, measured from the +z axis).
| Cartesian (x, y, z) | r | θ (degrees) | θ (radians) | φ (degrees) | φ (radians) |
|---|---|---|---|---|---|
| (1, 0, 0) | 1 | 0° | 0 | 90° | 1.5708 (π/2) |
| (0, 1, 0) | 1 | 90° | 1.5708 (π/2) | 90° | 1.5708 (π/2) |
| (−1, 0, 0) | 1 | 180° | 3.1416 (π) | 90° | 1.5708 (π/2) |
| (0, −1, 0) | 1 | −90° | −1.5708 (−π/2) | 90° | 1.5708 (π/2) |
| (0, 0, 1) | 1 | 0° (undefined, reported as 0) | 0 | 0° | 0 |
| (0, 0, −1) | 1 | 0° (undefined, reported as 0) | 0 | 180° | 3.1416 (π) |
| (1, 1, 0) | √2 ≈ 1.414214 | 45° | 0.7854 (π/4) | 90° | 1.5708 (π/2) |
| (1, 1, 1) | √3 ≈ 1.732051 | 45° | 0.7854 (π/4) | 54.7356° | 0.955317 |
| (0, 0, 0) | 0 | 0° (undefined, reported as 0) | 0 | 0° (undefined, reported as 0) | 0 |
Ranges from atan2: θ lies in (−180°, 180°] (that is, (−π, π]) and φ lies in [0°, 180°] (that is, [0, π]).
Convention Comparison and Angle Unit Conversion
Different books and software use the names θ and φ differently, so always check which angle a source means before comparing numbers.
| Convention | θ means | φ means | Notes |
|---|---|---|---|
| This page (common in mathematics texts) | Azimuth, from +x in the xy-plane, via atan2(y, x) | Polar angle, from +z axis, range 0° to 180° | Used by this calculator |
| Common physics convention (ISO 80000-2) | Polar angle, from +z axis | Azimuth, from +x in the xy-plane | θ and φ are swapped relative to this page |
| Geography (latitude/longitude) | Longitude = azimuth | Latitude = 90° − polar angle | Latitude ranges from −90° to 90° |
Reverse formulas (this page's naming)
$$x = r\sin\varphi\cos\theta,\qquad y = r\sin\varphi\sin\theta,\qquad z = r\cos\varphi$$
Degrees and radians
| Degrees | Radians (exact) | Radians (decimal) |
|---|---|---|
| 30° | π/6 | 0.5236 |
| 45° | π/4 | 0.7854 |
| 60° | π/3 | 1.0472 |
| 90° | π/2 | 1.5708 |
| 180° | π | 3.1416 |
| 270° | 3π/2 | 4.7124 |
| 360° | 2π | 6.2832 |
Conversion: \(\text{radians} = \text{degrees}\times\pi/180\). If you prefer θ in [0°, 360°), add 360° (or 2π) to any negative θ.
Interpreting Your Result
- r is the straight-line distance from the origin, so it is always ≥ 0.
- θ (azimuth) comes from atan2(y, x) and lies in (−180°, 180°]. A negative θ means y < 0; add 360° to get a value in the 0°–360° range.
- φ (polar angle) lies in [0°, 180°]. If φ < 90°, then z > 0 (upper hemisphere). If φ = 90°, then z = 0 (the point is in the xy-plane). If φ > 90°, then z < 0 (lower hemisphere).
- Undefined cases: on the z-axis (x = 0 and y = 0) θ is undefined, and at the origin both angles are undefined. The calculator reports 0 for undefined angles by the atan2(0, 0) convention.
Quadrant to θ range
| Signs of x, y | Location | θ (atan2 range) | θ (0°–360° range) |
|---|---|---|---|
| x > 0, y > 0 | Quadrant I | 0° to 90° | 0° to 90° |
| x < 0, y > 0 | Quadrant II | 90° to 180° | 90° to 180° |
| x < 0, y < 0 | Quadrant III | −180° to −90° | 180° to 270° |
| x > 0, y < 0 | Quadrant IV | −90° to 0° | 270° to 360° |
On the axes: +x gives 0°, +y gives 90°, −x gives 180°, and −y gives −90° (270°).
FAQ
What happens when x = 0? \(\operatorname{atan2}\) handles it cleanly: \(x = 0\) with \(y > 0\) gives \(\theta = 90^\circ\), and \(y < 0\) gives \(\theta = -90^\circ\).
What if z = 0? The point lies in the x-y plane, so \(\varphi = 90^\circ\) (\(\pi/2\)). A \(z < 0\) correctly yields phi greater than 90 deg.
What about the origin? If \(x = y = z = 0\) then \(r = 0\) and the angles are mathematically undefined; this tool reports 0 for both by \(\operatorname{atan2}\) convention.