Hiking Calculator

Hiking calculators / Route files (GPX)

GPX distance and elevation gain calculator

Open a GPX track or route to measure its length, total elevation gain and descent, in miles and feet with kilometers and meters alongside. The file is read in your browser and never uploaded.

Use a route file (optional)

Export a GPX from your watch, phone app or mapping site. It is read in your browser and never uploaded.

More inputs

Calculated in your browser. Nothing you enter leaves this page.

Example: 5.0 mi, +1,500 ft

Open a GPX file to measure its distance, climb and profile. Until then this shows the numbers typed below: 5.0 miles with 1,500 ft of climbing, about 2 h 32 min of walking.

How we got there

Distance5.00 mi8.05 km
Elevation gain1,500 ft457 m
Elevation loss1,500 ft457 m
Gain per mile300 ft/mi57 m per km
Moving time (Tobler)2 h 32 minaverage pace, good trail, day pack
Naismith's rule2 h 25 min3 mph + 1 h per 2,000 ft

How the distance and gain are measured

The page reads every track point (or route point) in the file: latitude, longitude and elevation. Distance is the sum of the straight-line distances between neighboring points over the curved surface of the earth. That's the standard way to measure a GPS track, and on a file with points every few seconds it follows the trail closely.

For elevation, the track is resampled every 20 m and elevation is averaged over about 100 m before anything is added up. Then every rise counts toward elevation gain and every drop toward descent. Without that smoothing, GPS jitter of a few meters per point would add hundreds of feet of phantom climbing to a long hike.

From the distance and gain you also get gain per mile (how steep the route is on average), a moving time from Tobler's hiking function and Naismith's rule for comparison. Nothing is uploaded: the file is read inside this page.

Exporting a GPX file from your app or watch

GPX is the common format almost every hiking and fitness tool can export. Look for the option on the activity or route itself:

  • Recorded activities on GPS watches and fitness apps usually have an export or download option on the activity page, often only on the website.
  • Trail and navigation apps can export a saved recording or a planned route, sometimes on a paid plan only.
  • Map-drawing tools let you draw a route and export it as a GPX track, with elevation taken from a terrain model.

A file with only a few widely spaced points, such as a route drawn with long straight lines between clicks, cuts corners and comes out short. A track recorded every second or two is more accurate. If the file has no elevation data, the distance still works but gain will read zero.

Why the numbers differ between apps

Distance usually agrees to within a few percent. Recording interval matters most: points far apart cut switchbacks short, and points recorded while you stand still can wander and add a little.

Elevation gain disagrees much more, and on a long, hilly hike the gap between two apps can be hundreds of feet. GPS elevation is noisy, barometric altimeters drift with the weather, and terrain models smooth out small ups and downs. Each app then smooths and adds up the data its own way. None of them is exactly right; treat any single number as an estimate and compare like with like. See what counts as elevation gain.

To see where the climbing is rather than just the total, open the same file in the GPX elevation profile viewer.

Questions

How do I measure the distance of a GPX file?

Open the file with the button above. The page adds up the distance between every pair of track points and shows the total in miles and kilometers, with the elevation gain and descent.

How is elevation gain calculated from a GPX file?

By adding up every rise in elevation along the track. GPS noise makes raw totals too high, so the elevations are smoothed over about 100 m first. Descent is added up the same way from every drop.

Why is my GPX distance shorter than the trail sign?

Widely spaced points cut corners on switchbacks, and the signed distance may follow a slightly different line or be rounded. A track recorded with frequent points is usually closer.

Why does my watch show more elevation gain than this?

Watches often count small rises that this page smooths away as noise, and barometric readings drift with the weather. Neither number is exact. Use the same tool every time you compare hikes.

How long will the route take to hike?

The result shows a moving time at an average pace. For your own pace, the trail surface and stops, open the same file in the hiking time calculator.

Sources

  • GPX 1.1 schema, TopoGrafix (topografix.com/GPX/1/1).
  • Distance: great-circle (haversine) distance between track points on a sphere of radius 6,371 km.
  • Tobler, W. (1993), Non-isotropic geographic modeling, NCGIA Technical Report 93-1.
  • Naismith, W. W. (1892), Scottish Mountaineering Club Journal 2: 136.

Method checked 2026-11-30. Full formulas on the methodology page.