Spherical Coordinates Calculator
Convert between Cartesian (x, y, z), spherical (r, theta, phi), and cylindrical (rho, phi, z) coordinate systems in 3D space. Choose your conversion direction and angle unit, enter your values, and get the result with a full step-by-step breakdown. The physics (ISO 80000-2) convention is used: theta is the polar angle from the +z axis and phi is the azimuthal angle from the +x axis in the xy-plane.
What are spherical coordinates?
Spherical coordinates describe a point in 3D space using three values: r (the straight-line distance from the origin to the point), theta (the polar angle between the +z axis and the line from the origin to the point), and phi (the azimuthal angle measured counterclockwise from the +x axis in the xy-plane). Every point in space has a unique spherical address, and the system is especially natural for problems with rotational symmetry, such as gravitational fields, antenna radiation patterns, and quantum mechanical wave functions.
Physics vs. mathematics convention
Two conventions exist for naming the angles, and confusing them is the most common source of errors. In the physics convention (used here, following ISO 80000-2), theta is the polar angle from the +z axis (0 to 180 deg) and phi is the azimuthal angle in the xy-plane (0 to 360 deg). In the mathematics convention, the roles are swapped: phi is the polar angle and theta is the azimuthal angle. Always check which convention your textbook or software uses before substituting values. This calculator uses the physics convention throughout.
Cartesian to spherical conversion
Given a point (x, y, z), compute r = sqrt(x^2 + y^2 + z^2). The polar angle is theta = arccos(z / r) and the azimuthal angle is phi = atan2(y, x), which correctly handles all four quadrants and is normalized to the range 0 to 2*pi. If r = 0 (the origin), both angles are conventionally set to zero. The cylindrical radius rho = sqrt(x^2 + y^2) is the distance from the z-axis and equals r * sin(theta).
Spherical to Cartesian conversion
Given (r, theta, phi) in the physics convention, the Cartesian coordinates are x = r sin(theta) cos(phi), y = r sin(theta) sin(phi), and z = r cos(theta). When theta = 0 or theta = pi, the point lies on the z-axis and x = y = 0 regardless of phi, so phi is undefined at the poles, just as longitude is undefined at the geographic poles. The cylindrical coordinate rho also equals r sin(theta) and represents the horizontal distance from the z-axis.
Cylindrical coordinate connections
Cylindrical coordinates (rho, phi, z) sit between Cartesian and spherical systems. Converting cylindrical to spherical: r = sqrt(rho^2 + z^2) and theta = atan2(rho, z), while phi stays the same in both systems. Converting spherical to cylindrical: rho = r sin(theta) and z = r cos(theta), again with phi unchanged. This makes cylindrical coordinates a natural intermediate step when moving between Cartesian and spherical systems for problems with axial symmetry.
Coordinate system conversion formulas
| From | To | Key formulas |
|---|---|---|
| Cartesian (x, y, z) | Spherical (r, theta, phi) | r = sqrt(x^2+y^2+z^2), theta = arccos(z/r), phi = atan2(y,x) |
| Spherical (r, theta, phi) | Cartesian (x, y, z) | x = r sin(theta) cos(phi), y = r sin(theta) sin(phi), z = r cos(theta) |
| Cylindrical (rho, phi, z) | Spherical (r, theta, phi_s) | r = sqrt(rho^2+z^2), theta = atan2(rho, z), phi_s = phi |
| Spherical (r, theta, phi) | Cylindrical (rho, phi, z) | rho = r sin(theta), phi = phi, z = r cos(theta) |
| Cartesian (x, y, z) | Cylindrical (rho, phi, z) | rho = sqrt(x^2+y^2), phi = atan2(y,x), z = z |
ISO 80000-2 physics convention: theta = polar angle from +z, phi = azimuthal angle from +x in xy-plane.
Frequently asked questions
What is the difference between physics and math convention for spherical coordinates?
In the physics (ISO 80000-2) convention, theta is the polar angle measured from the +z axis (0 to pi) and phi is the azimuthal angle in the xy-plane (0 to 2*pi). In the math convention, the symbols are swapped: phi is polar and theta is azimuthal. This calculator uses the physics convention. Always check your source before applying the formulas, because mixing the two conventions gives incorrect results.
Why does phi use atan2(y, x) instead of arctan(y/x)?
The simple arctan formula only returns values in the range -pi/2 to pi/2 and cannot distinguish points in opposite quadrants (for example, (1,1) and (-1,-1) give the same arctan). atan2(y, x) uses the signs of both y and x to return the correct angle anywhere in the full 0 to 2*pi range, handling the case x = 0 without a division error.
What happens when the point is at the origin (r = 0)?
At the origin, r = 0 and both theta and phi are undefined (any angles satisfy the equations). This calculator returns theta = 0 and phi = 0 in that edge case as a convention. In practice, the origin is a coordinate singularity, similar to how the geographic poles have undefined longitude.
Can I enter angles in radians instead of degrees?
Yes. Use the angle unit selector to switch between degrees and radians. All angular inputs and outputs update to the chosen unit. For reference, pi radians equals 180 degrees, so a polar angle of pi/2 radians is 90 degrees (the xy-plane).
What is the valid range for each spherical coordinate?
r must be 0 or greater. theta ranges from 0 (pointing along +z) to pi or 180 degrees (pointing along -z). phi ranges from 0 to 2*pi or 0 to 360 degrees. If you enter phi outside this range, the result is still valid because trigonometric functions are periodic, but the displayed phi value may be normalized into the standard range.
How are spherical coordinates used in real applications?
Spherical coordinates appear naturally wherever there is central or rotational symmetry. In physics, they simplify Coulomb's law, gravitational potential, and the Schrodinger equation for hydrogen. In engineering, they describe antenna radiation patterns and radar coverage. In computer graphics, they parameterize sphere surfaces and are used in environment mapping and sky models.