About this tool
Enter the coordinates of two points, in 2D or 3D, to get the straight-line (Euclidean) distance, the Manhattan distance, the midpoint and the change along each axis; in 2D the slope of the line is shown too. Everything is computed live in your browser.
The distance is √((x₂ − x₁)² + (y₂ − y₁)²), with a (z₂ − z₁)² term added in 3D. The midpoint averages each coordinate: ((x₁ + x₂)/2, (y₁ + y₂)/2), plus (z₁ + z₂)/2 in 3D. The Manhattan distance adds up the absolute differences along each axis.
Switch to Find an endpoint when you know the midpoint M and one endpoint P: the other endpoint is 2M − P for each coordinate, and the segment length is shown with it. Handy for geometry homework, CAD, game development and physics.
Frequently asked questions
What is Manhattan distance?
It is the sum of the absolute differences in x and y — the distance you would travel along a grid of streets rather than in a straight line.
When is the slope undefined?
When the two points share the same x coordinate the line is vertical, so the slope is undefined and shown as such.
What is the midpoint formula?
The midpoint of the segment between (x1, y1) and (x2, y2) is ((x1 + x2) / 2, (y1 + y2) / 2) — you average the x-coordinates and average the y-coordinates. In 3D you also average the z-coordinates.
How do I find an endpoint from the midpoint?
If M is the midpoint and P is the endpoint you know, the other endpoint is 2M − P for each coordinate. Switch to 'Find an endpoint' mode, enter the midpoint and the known endpoint, and it solves the rest.
Which distance formula is used?
The Euclidean distance in 3D: the square root of the sum of the squared differences in x, y and z, a direct extension of the Pythagorean theorem.
More tools