The 3D distance calculator above finds the shortest straight-line distance between two points in three-dimensional space. You give it six numbers — the x, y and z coordinates of each point — and it returns the Euclidean distance, the midpoint of the segment joining them, the displacement vector, and two alternative distance measures that are useful in different situations. Everything is computed live, so changing one coordinate updates the answer immediately.
Arb Digital publishes this alongside a large set of free geometry and statistics tools because three-dimensional coordinates turn up in far more places than school geometry. Surveyors work in easting, northing and elevation. Warehouse routing works in aisle, bay and level. Product designers work in millimetres on three axes. Machine-learning practitioners quietly use the same formula every time they compute a Euclidean distance in feature space. The arithmetic is short, but it is easy to get wrong when the numbers are large and the differences are small, and it helps to see the intermediate steps rather than a single figure.
What This 3D Distance Calculator Does
It applies the three-dimensional form of the distance formula to two points and reports the result together with four supporting quantities. The headline number is the ordinary Euclidean distance: the length of a taut string stretched between the two points through empty space. The midpoint is the point exactly halfway along that string. The displacement vector records how far you must travel on each axis to get from A to B, complete with signs, which the distance itself discards. The ground-plan distance drops the z coordinate entirely, and the Manhattan distance adds the three axis moves rather than combining them diagonally.
This is deliberately a different job from our slope calculator, which works with two points in the flat xy-plane and returns gradient, intercept and line equation. Slope is a two-dimensional idea: a single number cannot describe the tilt of a line in space, because a spatial line needs a whole direction vector. That is the boundary between the two pages. If your points have only x and y, use the slope calculator; if they have a third coordinate, use this one and read the displacement vector for direction. For distances measured across the curved surface of the Earth rather than through straight space, the right tool is our great circle distance calculator instead.
How to Use It
- Enter point A. Type the x, y and z coordinates in the first row. Negative values are fine and so are decimals.
- Enter point B. Fill the second row the same way. Make sure both points use the same units and the same axis conventions — mixing metres with feet, or swapping which axis is vertical, is the single biggest source of wrong answers.
- Set the decimal places. Four is a sensible default. Increase it when your coordinates run into the millions and the gap between them is a few centimetres.
- Read the headline distance, then check the displacement vector underneath it to confirm you entered the points in the direction you intended.
- Look at the contribution bars. If one axis dominates, small errors on the other two hardly matter; if all three are similar, every coordinate needs equal care.
The Formula and How It Is Calculated
The three-dimensional distance formula is a direct extension of the Pythagorean theorem. For points A at (x₁, y₁, z₁) and B at (x₂, y₂, z₂), the distance is the square root of the sum of the three squared coordinate differences: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). The midpoint is simply the average of each coordinate pair, and the Manhattan distance is the sum of the three absolute differences.
The reason the Pythagorean theorem extends this cleanly is worth seeing once. Draw the box whose opposite corners are A and B, with edges parallel to the axes. The diagonal across the base of that box is found by ordinary two-dimensional Pythagoras from the x and y differences. That base diagonal and the vertical edge then form a second right triangle, whose hypotenuse is the space diagonal you want. Applying Pythagoras twice gives the sum of three squares, which is exactly the formula above. Our Pythagorean theorem calculator handles the two-dimensional step on its own if you want to check the intermediate figure. Wolfram MathWorld's entry on distance gives the same construction generalised to any number of dimensions.
Work the default values through by hand. Point A is (1, 2, 3) and point B is (4, 6, 15). The differences are 3, 4 and 12. Squaring gives 9, 16 and 144, which sum to 169, and the square root of 169 is exactly 13. The midpoint is the average of each pair: (2.5, 4, 9). The Manhattan distance is 3 + 4 + 12 = 19, noticeably larger than 13, because it forces you to travel along the edges of the box rather than cutting across the diagonal. The ground-plan distance, dropping z, is √(9 + 16) = 5. That example is deliberately chosen to produce whole numbers so you can confirm the tool is behaving before you trust it on messier data.
Why the Squared Contributions Matter More Than the Raw Gaps
Because each difference is squared before it is added, the axes do not contribute in proportion to their gaps. In the worked example the z gap of 12 is four times the x gap of 3, but its contribution to the squared distance is sixteen times larger — 144 against 9. That means z accounts for about 85 percent of the total, x for about 5 percent, and y for about 10 percent. The bars under the result show exactly this split.
The practical consequence is that measurement precision should follow the dominant axis. If you are computing the distance between two survey points a kilometre apart horizontally and two metres apart vertically, an error of ten centimetres in the elevation is invisible in the final distance, while the same error in the horizontal position moves the answer by very nearly ten centimetres. Spending equal effort on all three axes is usually a waste. The reverse case is just as important: when all three gaps are similar, no axis can be treated as an afterthought, and rounding any one of them early will show up in the result.
Euclidean, Manhattan and Ground-Plan Distance Are Different Questions
The calculator reports three distances because real problems ask for different ones and people frequently pick the wrong one. Euclidean distance answers "how far apart are these two points". Manhattan distance answers "how far must something travel if it can only move along the axes" — the natural measure for a gantry crane, a warehouse robot restricted to aisles and lifts, or a plotter head that moves one axis at a time. Ground-plan distance answers "how far apart are they on a map", which is what you want when you are laying out a floor plan and the height difference is irrelevant to the question.
Manhattan distance is always greater than or equal to Euclidean distance, with equality only when the two points differ on a single axis. That relationship is a useful sanity check: if a tool ever reports a Manhattan distance smaller than the straight-line distance, something has gone wrong in the input. Ground-plan distance, by contrast, is always less than or equal to the full distance, and the two are equal only when the points share a z coordinate.
Reading the Displacement Vector, Not Just the Distance
Distance throws away direction. Squaring the differences destroys their signs, so (3, 4, 12) and (−3, −4, −12) give an identical answer of 13. That is exactly what you want when you are measuring separation and exactly what you do not want when you are describing a movement. The displacement vector in the results grid keeps the signs so you can see whether B is above or below A, left or right, ahead or behind.
If you need to go further and work with that direction — normalising it to a unit vector, taking a dot product against another direction, or finding the angle between two spatial lines — our vector calculator takes over from there. A useful habit when you are converting between coordinate conventions is to check the displacement vector first: a sign that looks wrong there almost always means the axis order or handedness was misread, and the distance alone would never have revealed it. If your source data arrives in polar or spherical form, convert it before you type it in with the coordinates converter.
Where Three-Dimensional Distance Shows Up Outside Geometry Class
Three coordinates do not have to mean three physical dimensions. Any three measured quantities on comparable scales can be treated as a point in space, and the distance between two such points is a general-purpose measure of how different they are. Colour work is a clear example: colours expressed as three coordinates can be compared by Euclidean distance to estimate how similar two shades look, which is the basic idea behind colour-difference metrics. Analytics work is another: two customer segments described by three standardised scores can be compared the same way, and the closest pair is the pair most alike.
The essential precondition is that the three axes are on comparable scales. Distance in space works because metres are metres on every axis. If one of your three quantities runs from 0 to 1 and another runs from 0 to 100,000, the second will dominate the squared sum completely and the distance will be a measure of that variable alone. Standardising each axis first — subtracting its mean and dividing by its standard deviation — restores comparability. Our z-score calculator does exactly that transformation for one variable at a time, and Paul Dawkins' 3-Dimensional Space notes from Lamar University set out the coordinate conventions the formula assumes.
Precision, Large Coordinates and Catastrophic Cancellation
The formula is exact in algebra but not in floating-point arithmetic. When two coordinates are both very large and very close together, subtracting them destroys most of the significant digits in the result — an effect numerical analysts call catastrophic cancellation. Two easting values around 512,345.678 that differ by two millimetres carry roughly nine significant digits each, and their difference carries barely one. Squaring it then makes matters worse.
There is a simple defence: shift the origin before you calculate. Subtract a convenient round number from every coordinate on that axis for both points, so 512,345.678 and 512,345.680 become 45.678 and 45.680. The distance is unchanged, because translation does not affect it, but the arithmetic now happens in a range where the available digits are useful. This is standard practice in surveying software and it costs nothing. If you are entering coordinates by hand into this page and the answer looks implausibly coarse, that is the first thing to try.
Arb Digital builds measurement and reporting systems that show their working, so the figure on the slide can always be traced back to the data behind it.
Browse All Free Tools Talk To Our TeamCommon Mistakes to Avoid
- Mixing units between axes — elevation in feet with easting and northing in metres produces a number that is not a distance in any unit at all.
- Forgetting to square before summing — adding the three raw differences gives the Manhattan distance, which is a legitimate figure but a different one, and it is always larger.
- Rounding the coordinates before subtracting — round the final distance, never the inputs, or you will lose precision exactly where it matters most.
- Treating unstandardised data as spatial coordinates — if the three axes have wildly different scales, the largest one silently becomes the whole answer.
- Assuming distance tells you direction — it does not, because squaring removes every sign; read the displacement vector for that.
Related Free Tools From Arb Digital
Work in the plane with the slope calculator, check a right-triangle step with the Pythagorean theorem calculator, handle direction and dot products with the vector calculator, measure across the globe with the great circle distance calculator, or turn a distance into a journey time with the speed distance time calculator. The full free online tools hub lists every mathematics tool we publish.
Frequently Asked Questions
Take the difference of the x coordinates, the y coordinates and the z coordinates, square all three, add them together, and take the square root of the total. It is the Pythagorean theorem applied twice.
No. Each coordinate difference is squared, which removes its sign, so the distance from A to B is always identical to the distance from B to A. Only the displacement vector changes sign.
Yes. Negative values are ordinary points on the other side of the origin and the formula handles them without any special treatment. The example works the same way if you shift every point into negative territory.
The same units you typed in. The calculator does no conversion, so all six coordinates must already be in one consistent unit before you enter them.
Euclidean distance cuts diagonally through space. Manhattan distance adds the three axis moves separately, as if you could only travel parallel to the axes. Manhattan is never smaller than Euclidean.
Average each coordinate pair independently: add the two x values and halve, then do the same for y and for z. The calculator reports that point in the results grid.
Because slope is a two-dimensional idea. A line in space needs a full direction vector rather than one number, so the tool reports the displacement vector instead of a gradient.
This page explains a mathematical calculation for educational purposes. Results depend entirely on the coordinates you supply, so check the units and axis conventions of your source data before relying on any figure.