About the Distance Formula Calculator
This distance formula calculator finds the straight-line (Euclidean) distance between two points. Enter the coordinates of both points, choose 2D for points on a plane or 3D if they also have a z value, and it returns the distance together with the horizontal, vertical and depth differences, the squared distance and the midpoint.
It is aimed at algebra and geometry students checking their working, but it is equally useful in game development, CAD sketches, robotics and data work, where the same formula measures how far apart two positions or feature vectors are.
Coordinates can be negative or decimal. The result is in whatever unit the coordinates use. Note that this is flat-space distance: for two places on Earth given as latitude and longitude you need a great-circle (haversine) formula instead.
With the default inputs, the distance is 10. Change any value above to recalculate instantly.
How to use the distance formula calculator
- 1Choose 2D or 3D.
- 2Enter the coordinates of the first point.
- 3Enter the coordinates of the second point.
- 4Read the distance, plus the coordinate differences and midpoint.
Formula and method
The distance formula is the Pythagorean theorem applied to coordinates. The horizontal gap Δx and vertical gap Δy form the two legs of a right triangle, and the segment joining the points is its hypotenuse, so its length is the square root of Δx² + Δy².
In three dimensions the same idea is applied twice, adding the depth difference Δz² under the square root. Because each difference is squared, the order of the points does not matter and negative coordinates work normally. The midpoint is simply the average of each coordinate.
- (x₁, y₁, z₁)
- Coordinates of the first point
- (x₂, y₂, z₂)
- Coordinates of the second point
- d
- Straight-line distance between the points
Worked examples
Points (2, 3) and (8, 11)
Δx = 8 − 2 = 6 and Δy = 11 − 3 = 8. Then d = √(36 + 64) = √100 = 10 — a scaled 3-4-5 triangle.
3D points (1, 2, 3) and (4, 6, 15)
The differences are 3, 4 and 12. Squaring and adding gives 9 + 16 + 144 = 169, and √169 = 13.
Points with negative coordinates (−3, 5) and (4, −2)
Δx = 7 and Δy = −7. Squaring removes the sign: √(49 + 49) = √98 ≈ 9.90.
Frequently asked questions
What is the distance formula?+
For two points (x₁, y₁) and (x₂, y₂), the distance is √((x₂ − x₁)² + (y₂ − y₁)²). It comes directly from the Pythagorean theorem, treating the gaps in x and y as the legs of a right triangle.
Does the order of the points matter?+
No. Each difference is squared, so (x₂ − x₁)² equals (x₁ − x₂)². Swapping the points gives the same distance, though Δx and Δy change sign.
How do you find the distance between two points in 3D?+
Add the squared z difference under the root: d = √(Δx² + Δy² + Δz²). Choose 3D in the calculator and enter a z value for each point.
Can I use this for latitude and longitude?+
Only for very short distances. Latitude and longitude are angles on a sphere, so for real travel distances use a great-circle (haversine) formula, which accounts for Earth’s curvature.
How is the distance formula related to the midpoint formula?+
Both use the two endpoints: the distance formula measures how far apart they are, while the midpoint formula averages their coordinates to find the point exactly halfway between.