Distance & Midpoint Calculator

Find the distance between two points and their midpoint.

Distance and midpoint between two points

The distance between two points on a plane comes straight from Pythagoras. The horizontal gap is x2 minus x1, the vertical gap is y2 minus y1, and the straight-line distance is the square root of the sum of their squares. The midpoint is simpler still: average the x values and average the y values, which gives the point exactly halfway along the segment.

Two practical notes. Squaring removes any sign, so the order of the points does not matter for distance — you get the same answer either way, which is a useful check. But it matters for direction if you are also calculating slope. And this straight-line formula assumes a flat plane, which is why it should not be used for distances between places on the Earth: over long spans the curvature makes a meaningful difference, and the haversine formula is used instead. For a room, a plot or a drawing, the flat-plane formula is exactly right.

Worked example

Take the points (2, 3) and (10, 9). The horizontal gap is 10 − 2 = 8 and the vertical gap is 9 − 3 = 6. The distance is √(8² + 6²) = √(64 + 36) = √100 = 10. The midpoint is the average of each coordinate: ((2 + 10) ÷ 2, (3 + 9) ÷ 2) = (6, 6).

This is the same 3-4-5 triangle that builders use, just scaled by two (6-8-10). Spotting these whole-number patterns is a quick way to check your answer.

Common mistakes to avoid

  • Forgetting to square the negative difference. (−8)² is 64, so the order of the points does not change the distance.
  • Adding the gaps instead of using the square root formula. 8 + 6 = 14 is the walking distance along a grid, not the straight-line distance.
  • Using this formula for long distances on a map. Over large areas the Earth's curve matters, so use a great-circle (haversine) calculation instead.

Last reviewed: 5 November 2026 by the YogiCalc team · How we calculate and verify · Spotted an error? Tell us

Frequently asked questions

Does the order of the two points matter?

Not for distance. The differences are squared, which removes any negative sign, so you get the same result either way. Order does matter for slope and direction, where the sign carries meaning.

How do I find the midpoint?

Average the coordinates: add the two x values and divide by two, then do the same for the y values. The result is the point exactly halfway along the line segment.

Can I use this for distance between cities?

No. This formula assumes a flat plane, and over long distances the Earth’s curvature makes it inaccurate. Great-circle methods such as the haversine formula are used for geographic distance.

How does it extend to three dimensions?

Add the third difference and square it alongside the others: the distance is the square root of the sum of the squared differences in x, y and z. The midpoint likewise averages all three coordinates.

What is the distance formula?

Distance = √((x₂ − x₁)² + (y₂ − y₁)²). It comes directly from the Pythagorean theorem applied to the horizontal and vertical gaps between the points.

Can the midpoint have decimal coordinates?

Yes. If the sum of the two x or y values is odd, the midpoint lands halfway between whole numbers, for example 1.5.