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.

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.