3D Distance Calculator
The distance between two points in three-dimensional space is the straight-line length of the segment joining them, and it follows directly from the Pythagorean theorem extended to three axes. This calculator takes the x, y and z coordinates of two points and returns the distance between them using the square root of the sum of the squared differences along each axis. The differences dx, dy and dz are the gaps between the two points along the three axes; squaring them, adding the squares and taking the square root collapses the three-dimensional separation into a single length. The method is exact and works for any two points, whether close together or far apart, with positive or negative coordinates. Engineers, game developers, surveyors, chemists working with molecular geometry, and students all rely on this formula to measure separations in space. Enter the six coordinates to get the distance immediately; the calculator also shows the per-axis differences so you can see the working. All six inputs are editable so you can test any pair of points. Every figure here is computed deterministically from the formula shown below, with a worked example that reconciles exactly to the calculator so you can follow each step yourself.
The 3D distance is sqrt(dx squared + dy squared + dz squared). From (1, 2, 3) to (4, 6, 8) the differences are 3, 4, 5, so the distance is 7.07.
3D Distance formula
d = sqrt( dx^2 + dy^2 + dz^2 )
dx = x2 - x1
dy = y2 - y1
dz = z2 - z1
d = straight-line distance between the points
This is the Pythagorean theorem in three dimensions. Square each axis difference, add the three squares, then take the square root to get the straight-line distance.
Worked example
Find the distance from point (1, 2, 3) to point (4, 6, 8).
- dx = 4 - 1 = 3, dy = 6 - 2 = 4, dz = 8 - 3 = 5
- Sum of squares = 3^2 + 4^2 + 5^2 = 9 + 16 + 25 = 50
- Distance = sqrt(50) = 7.07
The distance is 7.07. These are the calculator's default inputs, so the result above matches the widget exactly.
Distance for sample point pairs
d = sqrt(dx^2 + dy^2 + dz^2).
| From | To | Distance |
|---|---|---|
| (0,0,0) | (1,2,2) | 3.00 |
| (1,2,3) | (4,6,8) | 7.07 |
| (0,0,0) | (3,4,12) | 13.00 |
| (0,0,0) | (2,3,6) | 7.00 |
| (1,1,1) | (4,5,13) | 13.00 |
Mathematical reference: US National Institute of Standards and Technology (NIST).
3D Distance Calculator: frequently asked questions
How do you find distance in 3D?
Subtract the coordinates of one point from the other along each axis to get dx, dy and dz, square each difference, add the three squares, then take the square root. This extends the familiar two-dimensional distance formula by adding a third squared term for the z-axis.
Does the order of the points matter?
No. Distance is the same in either direction because each difference is squared, which removes any sign. Whether you go from point one to point two or the other way, the distance is identical.
Can I use negative coordinates?
Yes. Negative coordinates work without any special handling, since the formula squares the differences. The calculator accepts any real numbers for the six coordinates and returns the straight-line separation.
What units does the distance use?
The same unit as the coordinates. If the coordinates are in meters, the distance is in meters. Keep all six coordinates in the same unit for a meaningful result.
What is the 3D distance formula?
The distance equals the square root of the sum of the squared axis differences: d = sqrt(dx squared + dy squared + dz squared). From (1, 2, 3) to (4, 6, 8) the differences are 3, 4 and 5, so the distance is the square root of 50, about 7.07.
Official sources
- Mathematical functions and computational reference data (Digital Library of Mathematical Functions): US National Institute of Standards and Technology (NIST). As at 25 June 2026.
Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.