Complete guide
Distance formula calculator for 2D and 3D points
Enter two coordinate points and choose 2D or 3D. Calculator24 reports straight-line distance, coordinate differences, squared distance and the midpoint.
Distance between two points
Subtract matching coordinates, square each difference, add the squares and take the positive square root. Squaring removes direction, so reversing the two points gives the same distance.
Distance formula
The 2D formula follows from the Pythagorean theorem. Three dimensions add the squared z difference.
d₂D = √((x₂−x₁)² + (y₂−y₁)²)d₃D = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)Midpoint
Average each coordinate separately. The midpoint lies halfway along the segment and is shown with the result.
midpoint = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2)Units and coordinate systems
The answer uses coordinate units. Do not mix feet and meters or coordinates from different map projections without converting them first.
Worked example
For (2,1) and (6,4), the changes are 4 and 3. Their squared sum is 25, so distance is 5 and midpoint is (4,2.5).
Distance workflow
| Step | 2D operation |
|---|---|
| Differences | Δx=x₂−x₁; Δy=y₂−y₁ |
| Squared distance | Δx²+Δy² |
| Distance | positive square root |
| Midpoint | average each coordinate |
Frequently asked questions
What is the distance formula?
It is the square root of the sum of squared coordinate differences.
Can distance be negative?
No. Geometric distance is the nonnegative length of the segment.
Does point order matter?
No. Reversing the points changes difference signs but not their squares.
How does 3D distance work?
It adds the squared z-coordinate difference before taking the square root.
Does this calculate driving distance?
No. It calculates straight-line coordinate distance, not a route on roads.
What to keep in mind
Coordinates must use the same scale and reference system. In 2D mode, z values are ignored.
Results display up to 8 decimal places; exported numbers preserve calculation precision. This is a calculation summary, not an official certificate.