3D Distance Calculator
Calculate the straight-line (Euclidean) distance between two points in three-dimensional space instantly.
Enter the x, y, z coordinates of two points and click Calculate Distance to find the exact distance between them.
3D Distance Calculator
Calculate the straight-line (Euclidean) distance between two points in three-dimensional space instantly.
About the 3D distance calculator
Three-dimensional distance, also called Euclidean distance in 3D space, is the length of the straight line segment connecting two points in a coordinate system defined by three perpendicular axes: x (horizontal), y (vertical), and z (depth). It gives the shortest possible path between two points in space, as opposed to taxicab or Manhattan distance, which follows axis-aligned paths.
The formula for 3D distance is a direct extension of the two-dimensional Pythagorean theorem. For two points P₁(x₁, y₁, z₁) and P₂(x₂, y₂, z₂), the distance d is: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). The derivation applies the Pythagorean theorem twice: first to find the diagonal across the base of an imaginary rectangular box spanning the two points, then again to find the true 3D diagonal using that base diagonal and the height difference.
Negative coordinates do not pose any special difficulty. Because each coordinate difference is squared before being summed, the result is always non-negative, and taking the square root always yields a real, non-negative distance. For example, the distance between (−3, 0, 5) and (2, −4, 1) equals √((2−(−3))² + (−4−0)² + (1−5)²) = √(25 + 16 + 16) = √57 ≈ 7.55.
Unit consistency is crucial. All three coordinates of both points must be expressed in the same unit. If you mix metres and centimetres, or degrees of latitude with metres of altitude, the formula produces a meaningless number. The output distance will be expressed in the same unit as the inputs.
The 3D distance formula underpins dozens of real-world calculations. In physics, it measures the separation between particles, the magnitude of displacement vectors, and the radius of spheres in 3D space. In engineering and CAD, it verifies that two components are the correct distance apart or calculates the length of a diagonal member in a 3D structure. In computer graphics and game development, collision detection, lighting calculations, and character movement all rely on fast 3D distance computations. In aviation and aerospace, air traffic controllers and satellite systems track separations in three dimensions — latitude, longitude, and altitude. In molecular biology, the distances between atoms in a protein structure determine how the protein folds and functions.
A common mistake when working by hand is to forget the third term (z₂ − z₁)² and compute only the 2D distance projected onto the xy-plane. The 2D projection gives the correct answer only when the two points share the same z-coordinate (i.e., they lie in the same horizontal plane). For any other configuration, the true 3D distance is always greater than or equal to the 2D projected distance.
3D distance examples
Four worked examples covering positive, negative, and decimal coordinates.
| Points | Distance | Calculation |
|---|---|---|
| P₁(1, 2, 3) → P₂(4, 6, 8) | ≈ 7.071 | d = √(3²+4²+5²) = √50 ≈ 7.071 |
| P₁(0, 0, 0) → P₂(3, 4, 0) | 5 | Points share z = 0, so this reduces to the 2D Pythagorean theorem. |
| P₁(−1, 0, 5) → P₂(2, −4, 1) | ≈ 6.403 | d = √(3²+(−4)²+(−4)²) = √(9+16+16) = √41 ≈ 6.403. Negative coordinates handled automatically. |
| P₁(2, 3, 5) → P₂(8, 7, 1) | ≈ 8.246 | d = √(6²+4²+4²) = √68 ≈ 8.246 |
How to use the 3D distance calculator
- Enter the x₁, y₁, and z₁ coordinates of the first point in the Point 1 section.
- Enter the x₂, y₂, and z₂ coordinates of the second point in the Point 2 section. Negative values are accepted.
- Click Calculate Distance. The Euclidean distance is displayed together with the formula used.
- Click Reset to clear all six fields and calculate a different distance.
3D distance calculator FAQ
What is the 3D distance formula?
The formula is d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). It is derived by applying the Pythagorean theorem twice: once to find the diagonal across the floor of a rectangular box, and again to find the space diagonal using that floor diagonal and the height difference between the two points.
Does the order of the two points matter?
No. Distance is symmetric: d(P₁, P₂) = d(P₂, P₁). Whether you subtract x₁ from x₂ or x₂ from x₁, the result is the same once you square the difference. You can enter the points in either order and the calculator returns the same distance.
How do I handle negative coordinates?
Negative coordinates work exactly like positive ones. Squaring a negative number gives a positive result (e.g., (−5)² = 25), so negative coordinates never produce a negative distance. Simply enter the negative values as-is in the coordinate fields.
What if two points have the same z-coordinate?
If z₁ = z₂, the term (z₂ − z₁)² = 0, and the formula reduces to the standard 2D distance: d = √((x₂ − x₁)² + (y₂ − y₁)²). The calculator handles this automatically — there is no special case you need to select.
How is 3D distance used in GPS and navigation?
GPS satellites calculate their distance from a ground receiver using 3D coordinates (latitude, longitude, and altitude above Earth's surface). By measuring the distance from at least four satellites simultaneously and solving a system of equations, the receiver can determine its exact position. Air traffic control uses 3D distance to maintain safe separation between aircraft at different altitudes.
Can I calculate the distance between more than two points?
This calculator finds the distance between exactly two points. To find the total length of a path through multiple points, calculate the distance between each consecutive pair and sum the results. For example, for points A, B, and C the total path length is d(A, B) + d(B, C).