Distance Between Two Points
Enter two pairs of coordinates and get the straight-line distance between them — plus the horizontal and vertical legs that make up the right triangle.
The distance formula
distance = √((x2 − x1)² + (y2 − y1)²) — the Pythagorean theorem applied to coordinates. Enter four numbers, read the straight-line distance.
Order doesn't matter
Going from point A to B gives the same distance as B to A — each difference is squared, so the sign drops out.
What is the distance between two points?
The straight line on a flat plane
The distance between two points is the length of the straight line connecting them — the shortest path across a flat plane. Given a first point (x1, y1) and a second point (x2, y2), it is found with the distance formula: distance = √((x2 − x1)² + (y2 − y1)²). This is simply the Pythagorean theorem written for coordinates. The result is the "Euclidean" distance, the everyday notion of how far apart two spots are, whether they are pixels on a screen, cities on a map, or characters in a game world.
Enter the four coordinates and the calculator returns the distance plus Δx and Δy — the horizontal and vertical legs — instantly.
The formula has three short steps built from the two coordinate pairs.
distance = √((x2 − x1)² + (y2 − y1)²)First take the horizontal gap Δx = x2 − x1 and the vertical gap Δy = y2 − y1. Square each one — squaring also makes the value positive, so the order of the points never changes the answer. Add the two squares together, then take the square root. That square root is the distance, the hypotenuse of the right triangle whose legs are Δx and Δy.
Suppose the first point is (0, 0) and the second is (3, 4).
Horizontal leg (Δx)
3 − 0 = 3 — the distance moved left-to-right.
Vertical leg (Δy)
4 − 0 = 4 — the distance moved up-and-down.
Distance
√(3² + 4²) = √(9 + 16) = √25 = 5 — the straight-line distance.
The main output is the straight-line, or "Euclidean", distance — the length of a taut string stretched directly between the two points, not a path that follows streets or grid lines. The two supporting numbers, Δx and Δy, are the horizontal and vertical legs of the right triangle whose hypotenuse is that distance: Δx tells you how far apart the points are left-to-right, and Δy how far apart they are up-and-down. Together they explain why the distance is what it is. Because each leg is squared before being added, the order of the points does not matter — swapping them flips the sign of Δx and Δy but leaves Δx², Δy², and the distance unchanged. When the two points are identical, both legs are zero and the distance is zero. This single idea powers a huge range of real work: measuring gaps on maps, screens, and blueprints, checking how close two objects are in game development, hit-testing in graphics, and the nearest-neighbour comparisons at the heart of many data tasks.
The formula is exact, but a couple of practical points are worth keeping in mind.
Flat plane and consistent units
This is the straight-line distance on a flat, two-dimensional plane. It is not the driving distance along roads, nor the great-circle distance across the curved surface of the Earth, and it ignores any third dimension. The coordinates are also unit-agnostic, so the answer is only meaningful if both points use the same unit and the same scale — mixing metres with pixels, or one axis stretched relative to the other, produces a distance that means nothing.