Home / Math / Distance Calculator

Distance Calculator: Distance Between Two Points (2D and 3D)

Enter two points on a plane or in space and get the straight-line (Euclidean) distance between them, the coordinate differences, the squared distance and the taxicab distance for comparison.

By Adzita Editorial Team · Updated 2026-11-03 · How we build and check our tools

The distance formula

The distance formula is the Pythagorean theorem applied to coordinates. Draw a right triangle whose hypotenuse is the segment between your two points. The horizontal leg has length |x2 − x1|, the vertical leg has length |y2 − y1|, and the hypotenuse is the distance:

d = √((x2 − x1)² + (y2 − y1)²)

In three dimensions the same idea adds a third term for depth or height:

d = √((x2 − x1)² + (y2 − y1)² + (z2 − z1)²)

Squaring removes the sign of each difference, so the order of the points never matters and negative coordinates cause no trouble.

Worked checks you can do in your head

The classic 3-4-5 triangle gives a clean test. From (0, 0) to (3, 4) the differences are 3 and 4, the squares sum to 25, and the distance is 5. In three dimensions, the differences 3, 4 and 12 give squares 9, 16 and 144, a sum of 169, and a distance of 13. If you see whole-number results for whole-number inputs like these, the formula is being applied correctly. Most other inputs produce an irrational distance, which the calculator rounds for display to at most four decimal places.

Straight-line versus taxicab distance

The straight-line distance is the shortest path between two points. The taxicab or Manhattan distance, |dx| + |dy| (+ |dz|), is the length of a path that may only move along the axes, like a delivery route on a street grid. It is always at least as large as the straight-line value and equals it only when the points share a row or column. The page shows both so you can see how much longer a grid route is than the direct line.

Common mistakes and limits

Worked example

Find the distance between the points (−2, 1, 3) and (4, −3, 6) in three-dimensional space.

Inputs

Dimensions3D (x, y, z)
Point 1: x1-2
Point 1: y11
Point 1: z13
Point 2: x24
Point 2: y2-3
Point 2: z26

Result

Distance = 7.8102

Straight-line distance in three dimensions.

Difference in x6
Difference in y-4
Difference in z3
Sum of squared differences61
Workingd = √(36 + 16 + 9) = √61
Taxicab (Manhattan) distance13
Midpoint(1, -1, 4.5)

Accuracy note: Results use standard double-precision arithmetic, so very large or very small values may be rounded. Check important results by another method.

Frequently asked questions

How do you find the distance between two points?

Subtract the x values, subtract the y values, square both differences, add the squares and take the square root of the sum. For (1, 2) and (4, 6) that is √(9 + 16) = 5.

What is the distance formula in 3D?

Add a third squared difference for the z coordinates under the same square root. The result is the straight-line length between two points in space.

Does the order of the points matter?

No. Each difference is squared, so swapping the points only changes signs before squaring and the final distance stays exactly the same.

Can the distance be negative?

No. A distance is a square root of a sum of squares, so it is zero or positive. It is zero only when both points are identical.

What is the difference between Euclidean and Manhattan distance?

Euclidean distance is the straight-line length, while Manhattan distance adds the absolute differences along each axis, as if you could only travel along a street grid.

Midpoint CalculatorMidpoint of a segment from two endpoints, or the missing endpoint from one end and the midpoint.Slope CalculatorSlope, line equation, y-intercept, angle and perpendicular slope from two points.Pythagorean Theorem CalculatorFind the hypotenuse or a leg of a right triangle, with area, perimeter, angles and triple check.Percentage CalculatorPercent of a number, percent change, and increase or decrease by a percent, with working.

References and sources

  1. Euclidean distance as a consequence of the Pythagorean theorem, in standard coordinate geometry and linear algebra texts.

Check primary sources for anything you rely on.