Distance Calculator
Find the distance between two points five different ways: 2D and 3D straight-line distance, Manhattan (grid) distance, polar coordinates, and real-world geographic distance using the haversine formula, complete with the compass bearing. Every mode shows its step-by-step working, not just the answer.
Point 1
Point 2
| Mode | Use it when |
|---|---|
| 2D | Two points on a flat map, graph, or floor plan; also gives midpoint and slope. |
| 3D | Points in space: CAD models, room diagonals, drone flight paths. |
| Geographic | Two latitude/longitude pairs; great-circle distance plus compass bearing. |
| Manhattan | Grid travel like city blocks, warehouse aisles, or circuit-board traces. |
| Polar | Points given as radius and angle: radar plots, antenna patterns, surveying. |
The formulas, stated exactly
2D: d = square root of ((x2 minus x1) squared plus (y2 minus y1) squared). 3D adds (z2 minus z1) squared under the same root. Manhattan: d = absolute value of (x2 minus x1) plus absolute value of (y2 minus y1). Polar: d = square root of (r1 squared plus r2 squared minus 2 times r1 times r2 times cosine of the angle between them). Geographic uses the haversine formula with Earth's mean radius of 6,371 km: a = sin squared (delta-lat/2) plus cos(lat1) times cos(lat2) times sin squared (delta-lon/2); c = 2 times atan2(square root of a, square root of (1 minus a)); d = R times c.
One nuance worth knowing: the haversine treats Earth as a perfect sphere. Against the WGS84 ellipsoid model the error stays under about half a percent, fine for travel planning but not for surveying. This tool also reports the initial bearing, the compass heading you would start on when leaving point 1 along the great circle.
Worked examples, verified against the tool
2D: points (0, 0) and (3, 4). Differences are 3 and 4; squares are 9 and 16; the root of 25 is 5.00 units, with midpoint (1.50, 2.00) and slope 1.33. Enter these values and the tool returns exactly that.
Geographic: New York City (40.7128, -74.0060) to London (51.5074, -0.1278) gives 5,570.22 km, which is 3,461.17 miles, with an initial bearing of 51.2 degrees (northeast). The published great-circle distance for this city pair is about 5,570 km, so the tool lands right on it.
Manhattan: (1, 1) to (4, 5) gives |3| + |4| = 7.00, versus a straight-line 5.00, a ratio of 1.40 to 1. Polar: (r=5, 0 deg) to (r=5, 90 deg) gives 7.0711, which is 5 times the square root of 2, exactly as the geometry demands.
Related tools: our midpoint calculator, polar coordinates calculator, and missing coordinate calculator. A comparable multi-mode tool for reference is the distance calculator suite at Calculator.io.
What this tool does not do
Three honest limits. First, in the 2D, 3D, Manhattan, and Polar modes your coordinates define the unit: choosing "Miles" labels the answer in miles because your inputs were miles. Genuine numeric conversion between unit systems happens in Geographic mode, which computes in kilometers and converts from there. Second, geographic distance is "as the crow flies" along the surface, not driving distance; road routes are always longer. Third, the precision selector changes displayed decimals only; it does not change the underlying double-precision arithmetic.
Frequently asked questions
What is the difference between Euclidean and Manhattan distance?
Euclidean distance is the straight line between two points (the hypotenuse). Manhattan distance sums the absolute horizontal and vertical differences, like walking city blocks. Manhattan distance is always greater than or equal to the Euclidean distance for the same two points.
How accurate is the haversine formula?
Very good for most purposes: it treats Earth as a sphere of radius 6,371 km, and the error against the true ellipsoidal shape stays under about 0.5 percent. For New York to London it gives 5,570.22 km, matching published great-circle values.
What is initial bearing?
The compass direction you start traveling from the first point if you follow the great-circle route to the second point. Because the route curves, the bearing changes along the way; the tool reports the starting heading only.
Why is Manhattan distance useful?
Any time movement is constrained to a grid: city streets, warehouse aisles, printed circuit board traces, and the L1 norm used in some machine-learning models. It answers "how far will I actually travel" better than a straight line there.
Can I use this for driving distance?
No. Use Geographic mode for straight-line surface distance, but driving distance follows roads and is always longer. Check a routing service for drive times and mileage.
What units does the polar mode use for angles?
Degrees. Radii can be in any unit you like; the answer comes back in the same unit as the radii.
