2D, 3D & GPS (Haversine)
Last reviewed: April 2026
A distance calculator computes the straight-line (as the crow flies) or driving distance between two geographic points. It uses the Haversine formula for great-circle distance on the Earth's surface and is useful for travel planning, logistics, and geographic analysis.
Distance calculation depends on context. Straight-line (Euclidean) distance between two points uses the formula √((x₂−x₁)² + (y₂−y₁)²) — a direct application of the Pythagorean theorem. For geographic coordinates on Earth's curved surface, the Haversine formula accounts for the planet's curvature, producing accurate great-circle distances between latitude/longitude pairs. Driving distance is always longer than straight-line distance — the circuity factor (actual route ÷ straight line) averages 1.3–1.4 in urban areas.
On a flat grid (Cartesian coordinates), Euclidean distance works perfectly. For maps and GPS, geodesic distance along Earth's surface is more accurate for distances over ~10 miles. Manhattan distance (|x₂−x₁| + |y₂−y₁|) measures distance when you can only travel along a grid — useful for urban routing and certain algorithms. In three dimensions, add a z-component: √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²), which applies to aviation, submarine navigation, and 3D modeling. For travel time estimates based on distance and speed, use our Speed Distance Time Calculator.
| Formula | Use Case | Example |
|---|---|---|
| √((x₂-x₁)² + (y₂-y₁)²) | 2D Euclidean | Points on a grid |
| √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²) | 3D Euclidean | Objects in space |
| Haversine formula | Spherical (Earth) | GPS coordinates |
| |x₂-x₁| + |y₂-y₁| | Manhattan distance | City grid navigation |
For calculating distances on Earth's curved surface, the Haversine formula provides accurate results by computing the central angle between two latitude/longitude points and multiplying by Earth's radius (6,371 km or 3,959 miles). The formula accounts for the spherical geometry that flat-plane calculations ignore — at distances over 10 miles, the curvature error becomes significant. For a flight from New York (40.7°N, 74.0°W) to London (51.5°N, 0.1°W), the great-circle distance is approximately 3,459 miles — the shortest path over Earth's surface, which is why transatlantic flights curve north over the Atlantic rather than flying due east.
| Route | Straight-Line | Driving | Circuity Factor |
|---|---|---|---|
| NYC → Boston | 190 mi | 215 mi | 1.13 |
| LA → San Francisco | 347 mi | 382 mi | 1.10 |
| Chicago → Detroit | 238 mi | 282 mi | 1.18 |
| NYC → LA | 2,451 mi | 2,790 mi | 1.14 |
| London → Paris | 213 mi | 283 mi | 1.33 |
The circuity factor — the ratio of actual driving distance to straight-line distance — varies by terrain and road network. In dense urban areas with grid street layouts (like Manhattan), the circuity factor averages 1.3–1.4 because streets force indirect paths. In suburban areas with highway access, it drops to 1.1–1.2. In mountainous terrain where roads must wind through valleys and switchback up passes, the factor can exceed 1.5–2.0. GPS navigation apps calculate driving distance using detailed road network databases, while this calculator provides straight-line distance for flight path estimation, radio line-of-sight, and geographic analysis where road routes are not relevant.
Converting distance to travel time requires realistic speed assumptions. Highway driving averages 55–65 mph when accounting for traffic, stops, and speed variations — not the posted speed limit. Urban driving averages 15–25 mph in most cities. A 300-mile road trip at a realistic 55 mph average takes about 5.5 hours, not the 4 hours that 75 mph would suggest. Air travel adds significant non-flight time: a 500-mile flight takes about 1.5 hours in the air, but 2–3 hours of airport time (check-in, security, boarding, taxiing, deplaning) makes the total trip 3.5–4.5 hours — often comparable to driving for distances under 400 miles. For speed-distance-time calculations, use our Speed Calculator.
Latitude and longitude coordinates use degrees, minutes, and seconds (DMS) or decimal degrees. Converting between them: 40°42'46" N = 40 + 42/60 + 46/3600 = 40.7128° N. Most GPS devices and mapping APIs use decimal degrees. One degree of latitude always equals approximately 111 km (69 miles). One degree of longitude varies with latitude — 111 km at the equator but only 79 km at 45° latitude and 0 km at the poles. This is why flat-map distance calculations fail at high latitudes: the Mercator projection distorts east-west distances increasingly as you move away from the equator, making Greenland appear as large as Africa when Africa is actually 14 times larger.
Distance calculations serve numerous practical purposes beyond travel planning. Real estate uses radius searches ("homes within 5 miles of downtown"). Emergency services calculate response times based on station-to-incident distances. Logistics companies optimize delivery routes using distance matrices between all customer locations. Radio engineers use line-of-sight distance to determine signal coverage — a radio tower 100 feet tall has a horizon distance of approximately 12.2 miles assuming flat terrain. Astronomers measure distances in light-years (9.461 trillion km), parsecs (3.262 light-years), and astronomical units (Earth-Sun distance, 149.6 million km). At every scale, distance calculation uses the same underlying geometry adapted to the relevant coordinate system.
→ Multiply by 1.2–1.4 for driving distance. Straight-line distance underestimates road distance by 20–40% in most regions.
→ Use decimal degrees for calculations. Convert DMS coordinates to decimal before computing. Most online tools and APIs expect decimal format.
→ For short distances, Euclidean works. Under about 10 miles, flat-earth approximation introduces less than 0.1% error — no need for the full Haversine formula.
See also: Speed Calculator · Average Speed · Time Zone Converter · Unit Converter
Modern GPS receivers achieve accuracy of approximately 3–5 meters under open sky conditions, which translates to negligible error for distance calculations over anything more than a few dozen meters. Differential GPS (DGPS) and Real-Time Kinematic (RTK) systems improve accuracy to centimeter-level precision for surveying and construction. However, GPS accuracy degrades significantly in urban canyons (tall buildings reflecting signals), dense forests, and indoors. For driving distance and routing, GPS navigation systems use road network databases that map every road segment with its length, speed limit, and connectivity — the total driving distance is the sum of all road segments in the calculated route, not a formula-based estimate.
| Unit | Equivalent | Common Use |
|---|---|---|
| Mile (statute) | 1.609 km / 5,280 ft | US/UK road distances |
| Nautical mile | 1.852 km / 1.151 mi | Aviation, maritime |
| Kilometer | 0.621 mi / 1,000 m | Most countries' road distances |
| Light-year | 9.461 × 10¹² km | Astronomy |
| Astronomical Unit | 149.6 million km | Solar system distances |
| Parsec | 3.262 light-years | Stellar/galactic distances |
Runners and fitness enthusiasts frequently convert between distance units. A standard marathon is 42.195 km (26.219 miles). A half marathon is 21.098 km (13.109 miles). A 5K is 3.107 miles, and a 10K is 6.214 miles. Running a "mile" on a standard outdoor track requires exactly 4 laps (1,600 meters is technically 9.3 meters short of a mile). GPS watches measure running distance to within 1–3% accuracy on open roads but can show 5–10% error on tight turns, switchbacks, and indoor tracks due to signal interpolation between data points.
Whether measuring the gap between two GPS coordinates for a real estate search, calculating great-circle routes for aviation fuel planning, or estimating delivery zones for a logistics operation, accurate distance calculation forms the foundation of geographic analysis and spatial decision-making in both personal and professional contexts.
From measuring the gap between two GPS waypoints to calculating stellar parallax distances measured in parsecs, the mathematical principles of distance calculation — the Pythagorean theorem, the Haversine formula, and geodesic equations — connect everyday navigation to the deepest questions in astronomy and cosmology.
Different distance formulas serve different purposes depending on the context and required accuracy. Euclidean distance — the straight-line distance between two points using the Pythagorean theorem — is used in flat-surface calculations, computer graphics, machine learning (measuring similarity between data points), and robotics path planning. The Haversine formula calculates great-circle distance between two points on a sphere using latitude and longitude coordinates, accounting for Earth's curvature — essential for aviation, maritime navigation, and mapping applications where straight-line approximations become inaccurate over distances exceeding 10-20 miles. Manhattan distance (also called taxicab distance) calculates distance along grid lines rather than diagonally, useful for urban route planning where travel follows streets. Geodesic distance using the Vincenty formula provides the highest accuracy for Earth-surface calculations by modeling the planet as an oblate spheroid rather than a perfect sphere, important for surveying and precision mapping applications.
See also: Speed Distance Time Calculator · Slope Calculator · Pythagorean Theorem Calculator
→ Straight-line ≠ travel distance. This calculator computes "as the crow flies." Actual driving distance is typically 20–40% longer due to roads, terrain, and routing. Use map services for driving estimates.
→ Use coordinate distance for precision work. GPS coordinates give exact positions. The Haversine formula accounts for Earth's curvature for distances over a few miles.
→ Know quick distance references. 1 degree of latitude = ~69 miles (111 km) everywhere on Earth. 1 degree of longitude varies — 69 miles at the equator, 0 at the poles.
→ For travel planning, combine with time. Distance is only half the equation. Our Speed Distance Time Calculator converts between distance, speed, and travel duration for trip planning.
See also: Speed Distance Time · Pythagorean Theorem · Area Calculator · Road Trip Cost