What this calculator does
Find how far apart two points are, measured in a straight line. On a flat grid, picture the sideways gap and the up-and-down gap between the points. Those two gaps form the short sides (legs) of a right triangle. The straight line between the points is the long side, called the hypotenuse. So the Pythagorean theorem gives its length. In three dimensions, the same idea adds a third gap for height.
Enter the coordinates of both points. This distance calculator finds the change along each axis, squares the changes and adds them. Then it takes the square root. Whole-number and short-decimal coordinates also get an exact answer in simplified radical (square-root) form, such as 2√5. Along with the straight-line (Euclidean) distance, you get the squared distance and the Manhattan, or grid, distance. You also get the midpoint. In 2D, you get the slope and direction of the line from the first point to the second.
Where it's used
Why this math matters outside the classroom:
- City map grids. On a map grid, landmarks at (2, 3) and (8, 11) are √(36 + 64) = 10 blocks apart in a straight line.
- Video game range. A game checks an enemy at (120, 45) against a player at (60, 125) and finds they are exactly 100 pixels apart.
- Walking a street grid. Walking city blocks from (0, 0) to (3, 4) covers a Manhattan distance of 7 blocks, while the straight line is only 5.
- 3D printer moves. A printer nozzle moving from (0, 0, 0) to (2, 3, 6) cm travels √(4 + 9 + 36) = 7 cm.
- Comparing data points. An analyst compares customers described by (age, visits) such as (30, 4) and (34, 7) with the distance √(16 + 9) = 5.
Grade level and standards: Grade 8; Common Core State Standards for Mathematics 8.G.B.8. © Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.
How to use it
- Choose 2D for points written as (x, y), or 3D for points written as (x, y, z).
- Type the coordinates of the first point and the second point. Negative numbers and decimals are fine. The order of the two points doesn't change the distance.
- Read the distance, its exact form when there is one, and the other measurements below it.
- Open the working to see each difference, its square, the sum and the square root.
What the inputs mean
- Point 1: x₁
- Coordinates must use the same unit and the same scale on every axis. If x is in miles and y in kilometers, convert one of them first.
- Point 1: z₁
- Only used in 3D mode. In 2D mode the z boxes are hidden and ignored.
Formula and method
d = √((x₂ − x₁)² + (y₂ − y₁)²) d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²) Manhattan distance = |x₂ − x₁| + |y₂ − y₁| (+ |z₂ − z₁|) midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
d is the distance. (x₁, y₁, z₁) is the first point and (x₂, y₂, z₂) is the second. The bars | | mean 'ignore the minus sign'. The first line is the 2D distance formula. The differences x₂ − x₁ and y₂ − y₁ are the legs of a right triangle, and the line between the points is its hypotenuse. Squaring a difference always gives a positive number. That's why it doesn't matter which point you call the first.
In 3D, the distance across the floor is itself the hypotenuse of a flat triangle (in the x-y plane). The height difference stands straight up from it. Using the theorem twice gives the second line, with three squared differences under one root.
The Manhattan distance measures a route that can only move along the axes, like a taxi on a street grid. It's never shorter than the straight-line distance. It's equal only when the points differ in just one coordinate.
Worked example
On a coordinate grid, how far is the point (−3, −1) from the point (2, 11)?
- Change in x: 2 − (−3) = 5. Change in y: 11 − (−1) = 12.
- Square and add: 5² + 12² = 25 + 144 = 169.
- Take the square root: d = √169 = 13.
- The grid (Manhattan) distance is |5| + |12| = 17, and the midpoint is (−0.5, 5).
Result: The points are exactly 13 units apart. The line joining them has a slope of 12 ÷ 5 = 2.4. It points about 67.3801° above the positive x-direction.
Understanding the result
The distance is never negative, and it's zero only when the two points are the same. Its unit is the unit of the coordinates: grid squares, meters, pixels or whatever the axes measure.
The squared distance is handy when you only need to compare distances. It skips the square root and keeps whole numbers whole. The exact square-root form is what most algebra and geometry homework asks for.
Assumptions and limitations
- The coordinates are on a flat (Cartesian) grid with the same scale on every axis.
- Distance means the straight line between the points, unless you read the Manhattan result.
- Latitude and longitude are angles on a curved Earth, not flat coordinates. So this formula is only a rough guide for places more than a few miles apart.
- The exact square-root form is shown for coordinates with up to six decimal places. Longer decimals get the decimal answer only.
Frequently asked questions
Where does the distance formula come from?
From the Pythagorean theorem. Draw a sideways line from one point and an up-and-down line from the other. They meet at a right angle, and the line between the points is the hypotenuse. Its length is the square root of the two legs squared and added together.
Does it matter which point is first?
No. Swapping the points flips the sign of each difference. But squaring removes the sign, so the distance is the same either way.
What is the difference between Euclidean and Manhattan distance?
Euclidean distance is the straight line, as a bird would fly. Manhattan distance adds up the changes along each axis, ignoring minus signs, as you'd walk on a grid of streets. From (0, 0) to (3, 4), the first is 5 and the second is 7.
How do I write the distance in simplest radical form?
Leave the square root as it is, and pull out any perfect-square factor (like 4, 9 or 16). From (0, 0) to (2, 4), the squared distance is 4 + 16 = 20 = 4 × 5. So the distance is 2√5, about 4.4721.
How do I find the distance in three dimensions?
Add the squared change in z to the other two before taking the root. From (1, 2, 3) to (4, 6, 15) the changes are 3, 4 and 12. So the distance is √(9 + 16 + 144) = √169 = 13.
How this calculator is checked
Method: Euclidean distance formula derived from the Pythagorean theorem in two and three dimensions; Manhattan (L1) distance and midpoint definitions. The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.
Embed this calculator
Put this Distance Between Points Calculator on your own website or blog for free. Paste this code where you want it to appear: