Distance and Pythagoras Calculator: 2D, 3D and Slope Distance
Heading to the field? Install this site from your browser menu and this tool works with no signal. See how
Distance and Pythagoras Calculator: 2D and 3D
Right triangle sides, straight line distance between coordinates in two or three dimensions, and the slope distance from a horizontal run and a rise, which is the everyday survey case.
The 3D distance is the 2D formula run twice, which is why the classic 1, 2, 2 box has a diagonal of exactly 3. In the slope mode, entering a 100 m horizontal run with a 5 m rise gives a slope distance of 100.125 m, and that 125 mm is the difference between taping along the ground and the plan distance.

How to use this tool
Five problems, one theorem. Two legs to a hypotenuse, a hypotenuse and one leg to the other, straight line distance between coordinate pairs in 2D or 3D, and the slope distance from a horizontal run and a rise. Pick the mode and the inputs rearrange themselves.
The modes are all Pythagoras, applied once, twice, or backwards. Seeing them as one idea is genuinely useful, because it means a single mental check, does the longest side come out longest, covers all five.
From a theorem to a distance formula
The distance between two points in a plane is the hypotenuse of the right triangle whose legs are the coordinate differences: root of dx squared plus dy squared. Add a third dimension and you apply the theorem twice, first across the floor, then up the wall, which collapses to root of dx squared plus dy squared plus dz squared.
The classic check is the 1, 2, 2 box: its diagonal is root of 1 plus 4 plus 4, exactly 3. Whole number cases like that, and the 3-4-5 in the plane, are the verification backbone of this tool because their answers are known before any code runs.
Slope distance against horizontal distance
Tape along sloping ground and you measure the slope distance. Plans, setting out and areas all want the horizontal distance. The two differ by the vertical rise folded in through Pythagoras, and the size of the difference surprises people in both directions.
On a 5 percent grade, 100 m horizontal is 100.125 m along the slope, a difference of 125 mm, easily lost in tape sag and easily assumed away. On a 1 in 2 batter, though, 100 m horizontal is 111.8 m on the slope, and confusing the two is a 12 percent quantity error. The rule: the divergence grows with the square of the grade, so gentle slopes forgive and steep ones do not.
A worked check you can repeat on paper
Points at 1, 1 and 4, 5. The differences are 3 and 4, so the distance is 5, the plane 3-4-5 again. For the slope mode, a 100 m run with a 5 m rise: 10000 plus 25 is 10025, rooted is 100.1249. The tool reports the grade, 5 percent, and the excess over horizontal, 0.125 m, so the number you would argue about on site is stated directly.
Mistakes that catch people out
Booking slope distance as horizontal. Harmless on gentle grades, a 12 percent error on a 1 in 2 batter. Fix: reduce taped distances to horizontal before they reach a plan or an area.
Subtracting coordinates in mixed order. The squares forgive sign errors within one axis, but pairing x from one point with y from another does not. Fix: difference each axis separately, then square.
Giving the hypotenuse mode a leg longer than the hypotenuse. There is no such triangle. Fix: the tool rejects it; the usual cause is the two inputs swapped.
Treating 3D and 2D distance as interchangeable. The 2D distance between two boreholes ignores their elevation difference, which matters the moment the holes are deep. Fix: three coordinates in, three coordinates used.
How this was checked
The whole number cases anchor everything: 3 and 4 return exactly 5, the 1, 2, 2 box returns exactly 3, and the points 1, 1 and 4, 5 return exactly 5. The reverse mode recovers the 4 from a 5 and a 3 exactly, and rejects a leg of 5 against a hypotenuse of 3. The slope case of 100 and 5 returns root 10025 to full precision.
Related Calculators and Reference
Non right triangles are handled by the Triangle Solver, and the same right triangle drives the sagitta formula in the Circle and Arc Calculator. Grades and their angles convert in the Grade to Degrees Converter. For distances between surveyed positions rather than local coordinates, the Coordinate Converter handles latitude, longitude and UTM first. The Square Root Calculator gives square, cube and nth roots in simplest radical form. The Vector Calculator adds dot and cross products and the angle between two vectors in two and three dimensions.
