About Distance Math
“How far apart?” splits into two universes: geometry class's coordinate grid, where Pythagoras answers exactly, and the round planet, where straight lines become great circles and the formula grows trigonometry. Both live here, labeled honestly.
Pick the mode, enter the four values (negatives fine in both — southern latitudes and western longitudes are negative by convention), and get the distance with the working. Coordinate mode adds the midpoint; map mode converts between kilometers and miles automatically.
The rise-over-run companion to coordinate distance is the Slope Calculator.
The Two Formulas
Pythagoras for grids, haversine for globes:
2D: d = √((x₂−x₁)² + (y₂−y₁)²) Haversine: a = sin²(Δφ/2) + cosφ₁·cosφ₂·sin²(Δλ/2) d = 2R·atan2(√a, √(1−a)), R = 6,371 km
Worked examples: (1,2) to (4,6) is the famous 3-4-5 triangle — distance exactly 5, midpoint (2.5, 4). New York (40.71, −74.01) to Los Angeles (34.05, −118.24): 3,936 km / 2,446 miles of crow flight; the interstate drive runs about 4,500 km.
Worked Examples
Both modes exercised — every value from this calculator:
| From → To | Mode | Distance |
|---|---|---|
| (0,0) → (3,4) | 2D | 5 (the 3-4-5 triangle) |
| (1,2) → (4,6) | 2D | 5, midpoint (2.5, 4) |
| (−2,4) → (2,−4) | 2D | 8.94 |
| New York → Los Angeles | Map | 3,936 km / 2,446 mi |
| London → Paris | Map | ≈ 344 km / 214 mi |
| Sydney → Auckland | Map | ≈ 2,156 km / 1,340 mi |
The 3-4-5 rows aren't decoration — that triangle is the same squaring trick tile-setters and builders use to check corners.
Crow Miles vs Road Miles
Great-circle distance is aviation's and shipping's truth (flight paths arc poleward on maps precisely because the sphere's shortest path looks curved on flat projections), but ground travel adds geometry's taxes: road networks, terrain, water crossings. The 20–40% premium is typical; mountain and coastal routes exceed it, gridded plains undercut it.
Precision notes for the curious: the haversine's ~0.5% error comes from treating Earth as a sphere (it's an oblate ellipsoid — equatorial radius 21 km fatter); surveying-grade work uses Vincenty or geodesic libraries on the WGS84 ellipsoid. And decimal-degree inputs matter: 40.7128, not 40°42′46″ — convert DMS by degrees + minutes/60 + seconds/3600.