Distance Between Two Points Calculator

Two points on a coordinate grid, one straight line between them — how long is it? Enter both points and this distance between two points calculator applies the distance formula with its steps visible, and returns the midpoint of the segment as well.









The Formula Is Pythagoras in a Coat

The distance formula is not a new theorem; it is the Pythagorean theorem aimed at a grid. Between two points, draw the right triangle whose legs run parallel to the axes: the horizontal leg is the difference of the x-coordinates, the vertical leg the difference of the y’s, and the segment itself is the hypotenuse. Hence d = √((x₂−x₁)² + (y₂−y₁)²) — the right-triangle machinery of this hub wearing coordinates. Two properties fall out immediately and are worth owning: the order of the points does not matter (each difference merely flips sign, and the squares erase signs), and the formula degrades gracefully — points sharing an x or a y give a triangle with a zero leg, and the distance collapses to the other difference, exactly as a horizontal or vertical measurement should. Wolfram MathWorld’s distance article develops the same formula into three dimensions and beyond, where each new coordinate contributes one more squared term under the same root.

Worked Example: (2, 3) to (8, 11)

The defaults are chosen to land on the most famous right triangle in the scaled world: dx = 8 − 2 = 6, dy = 11 − 3 = 8, and the distance is √(36 + 64) = √100 = 10 — a 6-8-10 triangle standing on the grid, double the 3-4-5. The midpoint, average of the coordinates, is (5, 7) — check it by symmetry: from (2,3) to (5,7) is dx 3, dy 4, distance 5; from (5,7) to (8,11) is again 3, 4 and 5 — the midpoint halves the segment, as it must. A less rehearsed example for the formula’s general case: (−3, 1) to (4, −5): dx = 7, dy = −6, distance = √(49 + 36) = √85 ≈ 9.2195 — irrational, unremarkable, and the commonest species of real answer; the negatives pass through the squaring without any special handling, which is the formula quietly earning its keep in all four quadrants.

The Midpoint, and the Family It Belongs To

The midpoint — ((x₁+x₂)/2, (y₁+y₂)/2) — is the segment’s average in the most literal sense: average the x’s, average the y’s. It belongs to a family of averaging ideas that runs through the whole subject: the section formula generalises it to any ratio (the point a third of the way along weights the far end twice), the centroid of a triangle averages three vertices, and the midpoint’s own inverse problem — given one endpoint and the midpoint, find the other end by doubling and subtracting — is a standard examination move the formula makes mechanical: other end = (2×5 − 2, 2×7 − 3) = (8, 11) in the worked example, recovering the input. In applied dress the same arithmetic is the centre of a service area from two depots, the halfway campsite between trailheads, the balance point of two equal weights. The calculator prints it alongside the distance because the two questions travel together so reliably that separating them would be a false economy.

Where the Distance Formula Works for a Living

Everywhere coordinates measure anything. Mapping and GPS: local distances are this formula on projected coordinates (with the Earth’s curvature promoted to the haversine machinery at continental scales — the grid formula is its flat-earth limit, excellent within a city). Games and graphics: collision ranges, line-of-sight, camera distances — computed thousands of times a frame, often as the squared distance, since comparing d² values skips the square root and preserves every ordering; the trick is worth stealing for spreadsheets. Data science: Euclidean distance is the default geometry of clustering and nearest-neighbour methods — points in feature-space, distances as dissimilarity — and this page’s two-dimensional case is the seed of its n-dimensional generalisation, one squared term per feature. Trades and layout: checking a rectangle by its diagonals (equal diagonals, true corners) is the distance formula as a square-checker, the coordinate cousin of the 3-4-5 tape trick. The formula’s ubiquity is the point: it is the definition of “straight-line” in every gridded world, and fluency with it is fluency with the grid itself.

The Other Grid Distance: Manhattan and the Crow’s Rival

The straight line is not the only honest distance on a grid, and confusing the two is a professional hazard worth one section. Manhattan distance — |x₂−x₁| + |y₂−y₁|, the sum of the legs instead of their hypotenuse — measures travel constrained to the grid’s streets: between the worked example’s points it is 6 + 8 = 14, against the crow’s 10, and in a real city of blocks it is the distance a taxi actually drives. Neither is “the true distance” in the abstract; each is the truth under a different movement rule — free flight versus street-bound travel — and choosing wrongly (a delivery estimate by crow, a radio-range estimate by street) misprices the world by up to a factor of √2, the exact ratio between the two at 45°. The calculator computes the Euclidean figure, the hypotenuse this hub’s right-triangle machinery owns; the Manhattan figure is one addition away from the same differences, and knowing both exist — and which question is being asked — is the difference between a formula remembered and a geometry understood.

Related Tools

More from the Math Calculators hub: the Right Triangle Calculator — the theorem underneath — the Vertex Form Calculator for the parabolas these coordinates also draw, and the Cube Calculator, where the same root-of-squares becomes the space diagonal.

Frequently Asked Questions

Does it matter which point is (x₁, y₁)?

No — the distance is identical either way, because swapping the points negates both differences and the squares annihilate the signs. Midpoint too is symmetric. Choose the order that keeps the subtraction friendly (larger minus smaller where possible) purely for arithmetic comfort; the mathematics is indifferent. What must be consistent is the pairing: x with x and y with y inside each difference — crossing them is the one clerical error the formula cannot forgive, and it announces itself by failing sanity checks against the grid.

How do I find the distance in three dimensions?

Add the third difference under the same root: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). From (1, 2, 3) to (4, 6, 15): differences 3, 4, 12, and the distance is √(9 + 16 + 144) = √169 = 13 — a 3-4-12-13 ladder worth remembering beside its flat ancestors. The pattern generalises to any dimension count, which is why data scientists speak of Euclidean distance in spaces no one can draw; the two-dimensional page in front of you is the same object, drawn.

What if the answer is not a whole number?

Then it is an honest irrational, like √85 ≈ 9.2195 in the article’s second example — the norm, not the exception, since whole-number distances require the differences to form a Pythagorean triple. Report the exact radical for mathematics (√85 is the answer; 9.2195 is its portrait) and the decimal for measurement, at the precision the input earned. The calculator prints four decimals, from which any working rounding is yours to take.

How is the midpoint related to the distance?

The midpoint is exactly half the distance from each endpoint — the worked example verifies it: 5 from (2,3) to (5,7), 5 more to (8,11). Use the relationship as a check whenever both are computed by hand: if the two half-distances disagree, an arithmetic slip is present, and it is cheaper to find it on the check than in the structure built on the numbers. The section-formula relatives (quarter points, trisection points) inherit the same discipline — each divides the distance in the ratio it divides the coordinates.

What is the distance from a point to the origin?

The formula with (0, 0) as one end: d = √(x² + y²), the point’s own magnitude — for (6, 8) it is 10, the worked example’s length measured from the origin instead. This special case is everywhere under other names: the modulus of a complex number, the length of a vector, the absolute value grown into two dimensions. Recognising it inside the general formula is the moment the formula stops being a recipe and becomes a picture — every point carries its distance from the centre as a property, and the two-point distance is just that picture with the centre moved.

Can this measure distance on a map directly?

Yes, within the map’s own consistency: if the coordinates are a flat projection (a city grid, a game map, a floor plan), the formula on map units, scaled by the map’s scale, is the true distance. On raw latitude and longitude it is only an approximation — degrees of longitude shrink toward the poles, so the “grid” is not square — acceptable for short spans (a few kilometres at temperate latitudes, with longitude differences weighted by the cosine of the latitude) and wrong for journeys, which belong to great-circle mathematics. Know which world your coordinates live in, and the formula serves faithfully in its own. Inside its own world — the flat grid — it is not an approximation at all, but the definition of straightness itself, which is why everything from game engines to geometry proofs builds on it without a second thought.