Get distance and elevation stats from a GPX file
This tool reads a GPX track and computes the numbers that matter to hikers, runners and cyclists: total distance, cumulative elevation gain and loss, highest and lowest altitude, average grade, and — if the file has timestamps — moving time and pace. It also draws an elevation profile.
How it works
Track points are parsed with the browser’s DOMParser. Distance is the running
sum of Haversine great-circle distances between consecutive points. Elevation
gain adds up every upward step in the ele series and loss adds up every
downward step; a small threshold (the default ignores changes under a couple of
metres) suppresses GPS noise so the climb total stays realistic. Average grade is
gain over distance as a percent. If timestamps are present, moving time is the span
from first to last point and pace is time per kilometre.
Why GPS elevation data is noisy
Consumer GPS receivers (including those in smartphones and most sport watches) measure altitude using GPS satellites rather than a barometric altimeter, and satellite-derived altitude is inherently less accurate than horizontal position. Typical vertical error is 3–10 metres per reading. Without smoothing, summing every raw altitude change would produce wildly inflated elevation gain totals — a flat walk might falsely show 100+ metres of climb from GPS noise alone.
This tool applies a minimum step threshold before counting a change as real gain or loss. Steps smaller than a few metres are treated as noise and ignored. This single filter dramatically improves the quality of cumulative elevation totals compared to a raw sum.
Sports devices with barometric altimeters (Garmin Fenix, Suunto, Polar Vantage) produce much cleaner elevation data in their GPX exports, and you will notice the elevation profile looks smoother and the cumulative gain aligns better with published route data. Smartphone-exported tracks are typically noisier.
What each stat means for route planning
Total distance
Computed using the Haversine formula, which gives the great-circle distance between two lat/lon coordinates on a sphere. This is the “as the crow flies” distance along the surface of the Earth between each pair of consecutive GPS points — not a road distance or straight-line distance across the map. For a trail route with many switchbacks, the Haversine sum closely matches the true surface distance because each GPS point is captured along the actual path.
Cumulative elevation gain and loss
These are the two most useful numbers for assessing route difficulty. Gain tells you how much total climbing is involved regardless of where it occurs; loss tells you how much descent. On an out-and-back route the gain and loss will be approximately equal. On a point-to-point route where you end lower than you started, loss will exceed gain.
Average grade
Grade is elevation gain divided by horizontal distance, expressed as a percentage. A 10% grade means 10 metres of elevation gain per 100 metres of horizontal distance. This is a course average; individual sections may be much steeper. Use it as a quick comparability metric between routes.
Pace
If your GPX file has timestamps on each track point (Strava, Garmin Connect, and most sport apps include them), the tool calculates elapsed time and divides by distance to give pace. Note that this is total elapsed time, not moving time excluding stops — if you paused during a hike, the pace figure will be slower than your actual walking pace.
Example
For a short loop that climbs from 12 m to 25 m and returns, the tool reports a few hundred metres of distance, roughly 13 m of gain and 13 m of loss, a max of 25 m and a min of 12 m, and — with timestamps — a pace in minutes per kilometre. Everything is computed locally; nothing is uploaded.