Distance between points in simple words
Points on a graph have an address: x says how far across and y says how far up. To find the straight-line distance between two points, first find how far across and how far up you must go.
Those two moves make the two short sides of a right triangle. The distance is the long side, and the Pythagorean theorem finds it: square the two moves, add them, and take the square root.
Example: from (1, 2) to (4, 6) you go 3 across and 4 up. 3² + 4² = 9 + 16 = 25, and √25 = 5, so the points are 5 units apart. The midpoint, exactly halfway between, is (2.5, 4).
Places on Earth sit on a curved ball, so for latitude and longitude the calculator uses a formula made for a sphere instead.
Formula and method
Euclidean distance is √[(x₂ − x₁)² + (y₂ − y₁)²], adding (z₂ − z₁)² in 3D. Geographic mode uses the haversine formula on a sphere of radius 6,371.0088 km.
Worked example
Points (0, 0) and (3, 4) are √(9 + 16) = 5 coordinate units apart.
Midpoint and slope
Along with the distance, the calculator gives the midpoint, ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2), and in 2D the segment's slope Δy ÷ Δx as a reduced fraction. Points (1, 2) and (4, 6) are √(3² + 4²) = √25 = 5 apart, with midpoint (2.5, 4) and slope 4/3.
In 3D mode, Δz joins the sum under the root and the midpoint gains a z coordinate. Points (0, 0, 0) and (1, 2, 2) are √(1 + 4 + 4) = 3 apart, with midpoint (0.5, 1, 1).