Sphere Equation Calculator
Write the standard equation of a sphere from its centre and radius, then find a point's signed distance from the surface: negative inside, positive outside.
Sphere Equation Calculator
Background.
A sphere is every point that lies exactly the same distance from a centre. Write that sentence using Pythagoras's theorem in three dimensions and you get the equation (x − h)² + (y − k)² + (z − l)² = r², where (h, k, l) is the centre and r the radius. Substitute any point: if the left side equals r² the point is on the surface, if it is smaller the point is inside, and if it is larger the point is outside.
That test is the useful part. Here the centre-radius equation is written out for the sphere you describe, and a chosen point is then measured against its surface as a signed number: negative inside, zero on the surface, positive outside. The size of that number is a genuine distance in the units of your coordinates, the shortest gap between the point and the sphere, measured along the line through the centre.
It differs from simply substituting the point into the equation. For a sphere of radius 4 and a point 3.4641 units from the centre, the left side minus r² comes to −4, a quantity in squared units that grows with the size of the sphere. The signed distance is −0.5359, which says directly that the point sits just over half a unit inside.
Distance to the centre minus the radius is also the signed distance function that graphics programmers use to ray-march spheres, and the simplest collision test in a physics engine: two spheres touch when the gap between their centres equals the sum of their radii. In navigation, each range measured from a known point puts you somewhere on a sphere around it, and a position fix is where several such spheres meet.
Everything here is exact Euclidean geometry in x, y, z coordinates. Ellipsoids, and spheres fitted to scattered measurements, need other methods.
What is sphere equation calculator?
The standard equation of a sphere is (x − h)² + (y − k)² + (z − l)² = r². It says that the straight-line distance from any surface point (x, y, z) to the centre (h, k, l) equals the radius r. Expanding the squares gives the general form x² + y² + z² + Dx + Ey + Fz + G = 0, which hides the centre and radius until the squares are completed again. A point's signed distance from the sphere is its distance to the centre minus r.
How to use this calculator.
- Enter the centre in Center x, Center y and Center z, and the radius in Radius. If you only have the expanded equation, halve the x, y and z coefficients and change their signs to get the centre first.
- Enter the point you want to test in Point x, Point y and Point z, using the same units and axes as the centre.
- Read the signed distance. A negative value means the point is inside by that amount, a positive value means it is outside, and zero means it lies on the surface.
- Copy the equation shown with the result if you need the standard form. A negative centre coordinate appears with a plus sign, so a centre at x = −2 shows as (x+2)^2.
The formula.
The distance from the point (x, y, z) to the centre (h, k, l) is d = √((x − h)² + (y − k)² + (z − l)²), the three-dimensional form of Pythagoras's theorem, and the signed distance is d − r. Squaring both sides of d = r gives the standard equation, which is why the equation and the distance test describe the same surface; the right-hand side is shown as r², so a radius of 4 appears as 16. Because the result is d − r rather than d² − r², it is in the units of the coordinates and does not inflate for large spheres. The radius must be positive, since a radius of zero would describe a single point. The result reacts most to the coordinate in which the point is farthest from the centre, because each difference enters squared.
A worked example.
The sphere has centre (1, 2, 3) and radius 4, so its equation is (x − 1)² + (y − 2)² + (z − 3)² = 16. The test point is (5, 2, 3). Its differences from the centre are 5 − 1 = 4, 2 − 2 = 0 and 3 − 3 = 0, so the squared distance is 4² + 0² + 0² = 16 and the distance is √16 = 4. Subtracting the radius, 4 − 4 = 0: the point lies exactly on the surface, at the tip of the radius that points along the x-axis. Move the point to (3, 4, 5) and every difference is 2, so d = √12 = 3.4641 and the signed distance is −0.5359, just inside the sphere. At (4, 6, 3) the differences are 3, 4 and 0, d = √25 = 5, and the point is 1 unit outside.
Frequently asked questions.
How do I get the centre and radius from x² + y² + z² − 2x − 4y − 6z − 2 = 0?
What does a negative signed distance tell me?
How can I tell whether two spheres intersect?
Can I use the page for a circle in a plane?
Can I treat the Earth as a sphere with this equation?
References& sources.
- [1]OpenStax, Rice University. College Algebra 2e, 2021. Algebra and function chapters. Retrieved 2026-08-06.
- [2]OpenStax, Rice University. Precalculus 2e, 2021. Trigonometry and analytic geometry chapters. Retrieved 2026-08-06.
- [3]NIST/SEMATECH. e-Handbook of Statistical Methods, 2012. Chapter 1.3 and Chapter 4. Retrieved 2026-08-06.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 3 cited below
- Method
- (x-h)^2+(y-k)^2+(z-l)^2=r^2
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled