Coordinate Distance Calculator
Enter the coordinates of two points and get the straight-line distance between them. Choose 2D mode for points on a flat plane (x, y) or 3D mode for points in space (x, y, z). The result panel shows each step of the Euclidean distance formula worked through with your actual numbers so you can check every stage.
Formula
Worked example
Points A = (1, 2) and B = (4, 6): dx = 4 - 1 = 3, dy = 6 - 2 = 4. Sum of squares = 9 + 16 = 25. Distance = sqrt(25) = 5. Midpoint = ((1+4)/2, (2+6)/2) = (2.5, 4).
What is Euclidean distance?
Euclidean distance is the straight-line length of the segment connecting two points, measured as if you could draw a ruler directly between them. In a 2D plane the formula follows from the Pythagorean theorem: the horizontal and vertical separations (delta-x and delta-y) form the legs of a right triangle, and the distance is the hypotenuse. In 3D the same idea extends to three differences squared and summed before taking the square root. The name honours the ancient Greek mathematician Euclid, and the formula is the basis for distance in most everyday geometry, physics, engineering, and data-science contexts.
How to use this calculator
Select 2D or 3D from the Dimensions menu. Enter the coordinates of your two points in the x, y (and z) fields. The distance, coordinate differences, midpoint, and Manhattan distance all update instantly. The "Show your work" panel below the result traces every arithmetic step with your actual numbers so you can verify the calculation by hand or use it as a reference for homework or an exam.
Euclidean vs Manhattan distance
Euclidean distance is the shortest possible path between two points - the straight-line crow-flies distance. Manhattan distance (also called taxicab or city-block distance) is the sum of the absolute differences in each coordinate, and it represents the shortest path when you can only travel parallel to the axes, as on a grid of city blocks. For two points on a 2D plane, the Manhattan distance is always greater than or equal to the Euclidean distance; they are equal only when the two points share one coordinate so the path is already a straight line along one axis.
The midpoint formula
The midpoint of a line segment is the point exactly halfway between the two endpoints. In 2D the midpoint coordinates are ((x1 + x2) / 2, (y1 + y2) / 2), and in 3D a third component is added: ((z1 + z2) / 2). This calculator returns the midpoint alongside the distance, which is useful when you need to bisect a segment, place an object equidistant from two reference positions, or find a central anchor point for a geometric construction.
Common uses of the distance formula
The coordinate distance formula appears across many disciplines. In geometry and trigonometry it is used to prove congruence, compute perimeters and side lengths, and verify the classification of triangles. In physics it gives the separation between two bodies in simulations and force calculations. In computer graphics and game development it drives collision detection, pathfinding, and camera placement. In machine learning and data science, Euclidean distance is the default metric for k-nearest-neighbours, k-means clustering, and many dimensionality-reduction techniques. In GIS and mapping it underlies the flat-plane approximation for short-range distances before more accurate spherical formulas such as the haversine become necessary.
Quick reference: distance formulas
| Formula | Expression | Use case |
|---|---|---|
| 2D Euclidean | sqrt((x2-x1)^2 + (y2-y1)^2) | Flat-plane straight-line distance |
| 3D Euclidean | sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) | Spatial straight-line distance |
| 2D Manhattan | |x2-x1| + |y2-y1| | Grid/taxicab distance on a plane |
| 3D Manhattan | |x2-x1| + |y2-y1| + |z2-z1| | Grid distance in 3D space |
| 2D Midpoint | ((x1+x2)/2, (y1+y2)/2) | Centre of the segment |
| 3D Midpoint | ((x1+x2)/2, (y1+y2)/2, (z1+z2)/2) | Centre of the segment in 3D |
Summary of the formulas this calculator uses.
Frequently asked questions
What is the distance formula between two points?
In 2D, the distance between points (x1, y1) and (x2, y2) is the square root of (x2 - x1) squared plus (y2 - y1) squared. This is a direct application of the Pythagorean theorem: the two coordinate differences are the legs of a right triangle, and the distance is the hypotenuse. In 3D you add a third squared difference under the square root.
Can I use negative coordinates?
Yes. The formula works for any real-number coordinates, positive, negative, or zero. Squaring the differences removes the sign, so a difference of -3 contributes 9 to the sum just as a difference of +3 does.
What is the difference between Euclidean and Manhattan distance?
Euclidean distance is the straight-line distance - the shortest path between two points through open space. Manhattan distance is the sum of the absolute differences in each coordinate, which equals the shortest path when you are constrained to move only along axis-parallel directions (like navigating a city grid). Euclidean distance is always less than or equal to Manhattan distance.
How do I find the midpoint between two coordinates?
Average each coordinate separately. For two 2D points (x1, y1) and (x2, y2), the midpoint is ((x1 + x2) / 2, (y1 + y2) / 2). In 3D, add (z1 + z2) / 2 as the third component. This calculator outputs the midpoint automatically alongside the distance.
Does this calculator work for GPS latitude and longitude coordinates?
This calculator uses the Euclidean (flat-plane) formula and is intended for Cartesian coordinate pairs. For geographic coordinates in decimal degrees (latitude and longitude), the flat-plane formula gives a reasonable approximation only over very short distances where Earth curvature is negligible. For distances over a few kilometres, use a haversine or great-circle calculator that accounts for the spherical shape of the Earth.
How is the distance formula related to the Pythagorean theorem?
The 2D distance formula is a direct restatement of the Pythagorean theorem (a squared + b squared = c squared). The horizontal difference (delta-x) is one leg, the vertical difference (delta-y) is the other leg, and the distance between the two points is the hypotenuse (c). In 3D, the theorem is applied twice in succession, which yields the same form with three squared differences.