Distance between 2 points (2D)
This calculator finds the distance between two points in a plane, (X1, Y1) and (X2, Y2): the length of the straight line between them in 2D, also called the Euclidean distance.
The distance formula
d = √((X2 - X1)² + (Y2 - Y1)²)
It is the Pythagorean theorem: the horizontal difference X2 - X1 and the vertical difference Y2 - Y1 are the two legs of a right triangle, and the distance is its hypotenuse. Since both differences are squared, the order of the points doesn't matter.
The calculator also works backwards. Given one point, the distance, and one coordinate of the other point, it finds the missing coordinate. Two values fit, one on each side of the known point; the calculator gives the one where the first point's coordinate is the smaller (X1 below X2, or Y1 below Y2).
Example
The distance from (1, 2) to (7, 10):
-
The differences:
7 - 1 = 6and10 - 2 = 8 -
The distance:
d = √(6² + 8²) = √100 = 10
Frequently asked questions
How do you find the midpoint between two points?
Average the coordinates: ((X1 + X2) / 2, (Y1 + Y2) / 2). For (1, 2) and (7, 10), the midpoint is (4, 6).
What about points in 3D?
Add the third difference under the root: d = √((X2 - X1)² + (Y2 - Y1)² + (Z2 - Z1)²). The 3D Distance Calculator does it.
Does this work for places on a map?
Only over short distances on a flat map. For points given in latitude and longitude, the Earth's curve matters, and the distance needs the great-circle (haversine) formula.