The formula
How it works
Find the straight-line distance between two points on a plane. Enter the X and Y coordinates of each point and the calculator applies the distance formula, also giving the midpoint and the slope.
FAQ
What is the distance formula?
It is the Pythagorean theorem applied to coordinates: the distance between two points is the square root of the squared horizontal gap plus the squared vertical gap. In effect the two points form the ends of a right triangle’s hypotenuse, and the formula measures its length.
Can it handle negative coordinates?
Yes. Coordinates can be positive or negative, and the formula squares the differences, so the result is always a positive distance regardless of where the points sit. That also means the order of the two points does not change the answer.
What does the midpoint tell you?
The midpoint is the point exactly halfway between the two coordinates, found by averaging the X values and averaging the Y values. It marks the centre of the line segment that joins the two points.
What does a negative or undefined slope mean?
A negative slope means the line falls as it moves to the right, while a positive slope means it rises. The slope is undefined when both points share the same X coordinate, since that gives a vertical line with no horizontal run to divide by.
Does the formula work in three dimensions?
This calculator only handles two coordinates, X and Y, but the same idea extends to 3D by adding a squared Z-difference term under the square root. The underlying Pythagorean logic stays the same, just with one more axis.
What units is the distance measured in?
The result is in whatever units the coordinates use, since the calculator itself is unit-agnostic. Enter coordinates in metres and the distance comes out in metres; enter them in pixels and it comes out in pixels.
Why is the distance shown rounded?
The result is displayed to a few decimal places for readability, even though the exact value can be an irrational number such as a square root. Rounding only affects the display, not the underlying calculation.
About the distance calculator
This calculator finds the straight-line distance between two points given their coordinates. It is a core piece of coordinate geometry, built directly on the Pythagorean theorem, and it also reports the midpoint of the two points and the slope of the line joining them. Together these describe the segment between the points completely — its length, its centre and its steepness.
How to use it
Enter the X and Y coordinates of the first point and the second point. The calculator returns the distance between them, the coordinates of the midpoint, and the slope of the connecting line. For example, the points (0, 0) and (3, 4) are exactly 5 units apart, with a midpoint at (1.5, 2) and a slope of 4⁄3.
The formula
The distance is , the square root of the sum of the squared coordinate differences. The midpoint is the average of the coordinates, , and the slope is the rise over the run, . All three follow from the positions of the two points.
Where it is used
Students meet the distance formula throughout geometry and algebra, and it is fundamental in fields from computer graphics and mapping to physics and engineering, wherever the gap between two positions matters. Any time coordinates describe locations — pixels on a screen, points on a map, nodes in a model — measuring the straight-line distance between them relies on this calculation.