GPX Distance Calculator
Paste lat/lon waypoints to calculate total route distance using the haversine formula. Free for hikers, runners, and route planners.
Quick Answer
The haversine formula computes great-circle distance between latitude/longitude pairs. Paste waypoints (one per line as “lat, lon”) and get the cumulative distance along the route. Accurate within 0.5% for any hiking-scale distance.
Format: latitude, longitude per line. Decimal degrees only. Comma or space separated.
Segment Distances
| # | From → To | km | miles |
|---|---|---|---|
| 1 | 37.7749, -122.4194 → 37.8044, -122.2712 | 13.43 | 8.34 |
| 2 | 37.8044, -122.2712 → 37.8716, -122.2727 | 7.47 | 4.64 |
| 3 | 37.8716, -122.2727 → 37.8651, -119.5383 | 240.02 | 149.14 |
About This Tool
The GPX Distance Calculator computes total distance along a route from a list of latitude/longitude waypoints using the haversine formula. It's the standard tool for trip planning when you have GPS coordinates from a topo map, mapping app, or GPX file. The haversine formula is accurate to within 0.5% for any hiking-scale distance, which is more than precise enough for trail planning, race courses, and route distance verification.
How the Haversine Formula Works
The haversine formula calculates the great-circle distance between two points on a sphere given their latitudes and longitudes. The formula: a = sin²(Δφ/2) + cos(φ₁) · cos(φ₂) · sin²(Δλ/2), then c = 2 · atan2(√a, √(1-a)), then distance = R · c, where R is Earth's radius (~6,371 km). It's named after the haversine function, half of (1 - cos(θ)). The formula handles the curvature of Earth's surface, which matters for distances above ~10 km. For hiking and running scales, it's essentially perfect.
Where to Get Coordinates
The fastest sources: Google Maps (right-click any point and click the lat/lon to copy), Gaia GPS or CalTopo (click points to display coordinates), OpenStreetMap (search any feature). For named landmarks, peakbagger.com and Wikipedia list precise coordinates. For race courses, organizers usually publish a GPX file you can decode using free GPX viewers. Most GPS devices export waypoints as decimal degrees by default.
Coordinate Formats
This tool accepts decimal degrees only — the standard format used by GPS devices and digital maps. Format: latitude (positive for North, negative for South), comma or space, longitude (positive for East, negative for West). Examples: 37.7749, -122.4194 (San Francisco) or 51.5074 -0.1278 (London). If you have degrees-minutes-seconds (37°46'30"N), convert to decimal first: degrees + minutes/60 + seconds/3600.
GPX vs. Trail Distance
The distance this tool calculates is the straight-line (great-circle) distance between consecutive waypoints. Real trail distance is longer because trails switchback, contour around obstacles, and follow terrain. Rule of thumb: real trail distance is 5-15% longer than waypoint-to-waypoint great-circle distance for typical terrain, more in steep switchback country (20-30% longer). For accurate trail planning, use waypoints spaced 0.5-1 mile apart along the actual trail path, not just at start/end/peak.
Use Cases
Trip planning: estimate total mileage from named waypoints on a topo map. Race verification: confirm advertised race distance from coursebook lat/lons. Route comparison: evaluate multiple route options between same start/end. Trail audit: cross-check GPS-recorded mileage against expected distances. Multi-day planning: divide total mileage into reasonable daily segments and compute distances between camps.
The Earth Isn't a Perfect Sphere
Earth is slightly oblate (squished at the poles), so the haversine formula has small errors compared to formulas that account for the ellipsoid (Vincenty's formula). For distances under 100 km, haversine error is under 0.05%. For 1,000 km routes, error is around 0.5%. For most outdoor sports applications, haversine is more than accurate enough. Vincenty's formula is used for surveying and aviation where higher precision matters.
Combine With Other Trail Tools
Pair this with our elevation gain calculator, our hiking time calculator, our trail running pace calculator, and our summit time calculator.