Spherical ↔ Cartesian Coordinates Conversion Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/10/2026
To convert Cartesian coordinates to spherical: r = √(x²+y²+z²), θ = acos(z÷r), φ = atan2(y, x). The point (3, 4, 12) in Cartesian corresponds to about (13, 22.62°, 53.13°) in spherical.
Explanation
Spherical coordinates extend to three dimensions the principle of polar coordinates, already available in 2D on this site: instead of locating a point only by a distance and an angle, you need here a distance r (from the origin) and TWO angles to fully situate a point in space. The angle θ (theta), called the polar angle, measures the point's inclination relative to the vertical +z axis (0° at the north pole, 90° on the equatorial plane, 180° at the south pole); the angle φ (phi), called the azimuthal angle, measures the rotation about that axis in the horizontal xy plane, exactly like the 2D polar angle. This convention, called physical or ISO, is the most widespread in physics and engineering; note that an alternative mathematical convention exists, where the roles of θ and φ are sometimes swapped — always check the convention used in your context before comparing results between different sources. Spherical coordinates have a direct application wherever a phenomenon radiates or varies mainly as a function of distance from a central point: geolocation (latitude and longitude are conceptually close to θ and φ, applied to the surface of a fixed-radius sphere, that of the Earth), antenna radiation, the gravitational or electric potential around a point mass or charge, or the description of atomic orbitals in quantum mechanics.
Example: convert the Cartesian point (3, 4, 12) to spherical
Inputs
x = 3. y = 4. z = 12.
Calculation
r = √(3² + 4² + 12²) = √(9+16+144) = √169 = 13. θ = acos(12 ÷ 13) ≈ 22.62°. φ = atan2(4, 3) ≈ 53.13°.
Result
This Cartesian point corresponds to the spherical coordinates (13, 22.62°, 53.13°).
Frequently asked questions
Why use atan2(y, x) rather than a simple arctan(y/x) to calculate φ?
Because arctan(y÷x) alone cannot distinguish a point in the first quadrant from a point in the opposite quadrant (x and y both with inverted sign), both giving the same y÷x ratio. The atan2 function, which takes x and y separately rather than just their ratio, resolves this ambiguity by accounting for the sign of each coordinate to place the angle in the right quadrant, over the full range from 0° to 360°.
What happens if the point is exactly on the z axis?
On the +z axis (θ = 0°) or the −z axis (θ = 180°), the x and y coordinates are both zero, whatever angle φ is chosen — that angle then becomes undefined, since rotating about the z axis does not change the position of a point that is precisely ON that axis. It is a normal special case of spherical coordinates, illustrated by this calculator's third test case.
Is this convention universal?
No, this is a real point of vigilance: the so-called "physical" convention used here (θ = polar angle from the z axis, φ = azimuthal angle) is standard in physics and engineering, but some mathematics texts swap the roles of θ and φ, or measure the polar angle from the equatorial plane rather than from the pole (as geographic latitude does). Always check the convention adopted by your source before comparing spherical angles between two different documents — the distance r itself, on the other hand, is always the magnitude of the vector connecting the origin to the point, whatever the angular convention chosen.