Trail Notes

How to Reverse a GPX Track or Route

The same line, the other way: what to do with the timestamps, and what else turns round with it.

Edit Reading time: 7 minutes Updated By the GPX Analyzer project

How Do You Reverse a GPX Track or Route?

Load the file into GPX Reverse, tick the tracks and routes to turn round, choose what happens to the timestamps, and download. Every point is moved whole, with its elevation and any sensor data, into the opposite order. Waypoints stay as they are, because a place has no direction. The one decision is the timestamps: a recording played backward runs backward in time, so the tool removes them, rewrites them to run forward, or keeps them, as you choose. Remove is right for a line you mean to follow. The distance stays the same. The climb and the descent change places, and so do the lefts and rights. Nothing is uploaded.

Do You Need a Reversed File?

A dirt track seen from a mountain pass, winding back down the slope it climbed toward a wide desert valley in low golden light

A GPS unit or app guides you along a line in the order its points are written, so to be guided the other way the order has to change. That needs a new file. But several questions about the way back can be answered without one.

You wantDo this
To follow the line the other way on a deviceReverse the file in GPX Reverse. Some devices can follow a saved course backward on their own; check yours first
To know how long the way back takesTick "Walk it in the other direction" in the Hike Time Estimator
A printed list of turns for the way backTick "Travel it in the other direction" in the Cue Sheet Generator
To check fuel stops in the other directionTick "Travel it in the other direction" in the Fuel Range Calculator
A route for a GPS, the other way, from a recorded trackTick "Reverse direction" in GPX Track to Route, which does both jobs at once
There and back in one fileReverse the file, then join the two. See below

Reverse It, Step by Step

The example is a one-way walk from a trailhead over a pass to a camp. The file holds a recorded track of 10 points and 6.8 km, a 4-point route along the same line, and 3 waypoints. The aim is a file to follow from the camp back to the trailhead.

  1. Load the file. Open GPX Reverse and drop the .gpx file on it. Every track and route in the file is listed with its points and its length.
  2. Choose what to reverse. Everything starts ticked. Untick a track or a route to leave it as it is.
  3. Decide about the timestamps. Remove, Rewrite, or Keep. The next section covers the choice. The question is asked only when the file has timestamps.
  4. Check the map. Arrows along each line show the new direction. The green mark is the new start and the red mark the new finish.
  5. Download. The file is saved with _reversed added to its name, and "(reversed)" added to the name of each track and route unless you untick that box. The original is not changed.

For the example the tool reports: "1 track and 1 route reversed. 14 points put in the opposite order · 10 timestamps removed · 3 waypoints kept." In the new file the track begins at the camp, at 1,210 m, and ends at the trailhead, at 880 m. Each point still has its elevation and its heart rate reading. The route now lists Camp, Pass, the fork, and Trailhead in that order.

What to Do About the Timestamps

A recorded track has a time on every point. Put the points in the opposite order and the times run backward: the first point is the latest. Some software refuses a file like that, and all of it will be confused about speed.

ChoiceWhat it doesFor the exampleChoose it when
RemoveTakes the times out of the reversed tracks and routesNo times. The file validates with no errors or warningsYou want a line to follow. A line to follow needs no times
RewriteGives the reversed track new times that run forward. It starts and ends when the original did, and every interval is mirroredStill 15:00:00 to 17:42:00. The 12 minutes that ended the walk now begin it. Validates cleanThe file has to pass as an activity on a site that will not accept one without times
KeepLeaves each time on its pointRuns from 17:42:00 back to 15:00:00. The GPX Validator warns: "Timestamps are not in chronological order"You mean to reverse it again later and want the original back exactly

Rewritten times are not a record of anything. Nobody walked the reversed line at those times; the tool has only mirrored the pace of the original. Use them to get a file accepted, not to claim a time.

What Changes When You Turn a Line Round

The elevation profile of the example walk as recorded, 450 meters up and 120 down, and reversed, 120 meters up and 450 down As recorded 450 m up, 120 m down 900 m 1,100 m 1,300 m Trailhead Camp 0 km 6.83 km Reversed 120 m up, 450 m down 900 m 1,100 m 1,300 m Camp Trailhead 0 km 6.83 km

The example's elevation profile each way, drawn from the file. The same ground, with the long climb turned into a long descent.

  • The distance does not change. The GPX Analyzer measures 6.83 km for the original and for the reversed file.
  • Climb and descent change places. The walk as recorded goes 450 m up and 120 m down. Reversed, it is 120 m up and 450 m down. The Analyzer's elevation gain drops from 450 m to 120 m.
  • The time changes. By Naismith's rule the walk as recorded takes 2 h 07 min and the way back 1 h 34 min, because the rule charges for ascent. Do not assume the return takes as long as the way out, in either direction.
  • Every turn flips. A left becomes a right, and the distances are counted from the other end.

The last point shows clearly in a cue sheet made from each file:

As recordedReversed
2.3 km: bear right1.6 km: bear left
4.6 km: Pass, bear left2.2 km: Pass, bear right
5.3 km: bear right4.5 km: bear left

Read across and the rows do not line up, because the first turn out is the last turn back: the bear right at 2.3 km is the bear left at 4.5 km.

What Does Not Change, and Should

  • Instructions written into names. The example's route has a point named "Turn right at the fork". After reversing it is still named that, and the turn is now a left. The tool moves names with their points and does not rewrite them, and says so in its result. Rename such points, or let a cue sheet work the turns out afresh from the line.
  • One-way sections. A file knows nothing about a one-way street, a trail meant to be ridden downhill only, or a river crossing that is easier from one bank. Reversing the line does not check that the way back is allowed or possible.
  • What a device recalculates. A GPS set to follow roads may work out its own way between route points, and going the other way it may choose differently.
  • Sensor readings. Heart rate and the like stay with the place they were recorded. In a rewritten file the high readings from the climb now sit on a descent.

Routes Saved by Garmin Software

Garmin's programs often store the detailed path from each route point to the next inside that route point. Turning the list of route points round without moving those paths would leave each one attached to the wrong leg. GPX Reverse moves each path to the point that now begins its leg and turns it round, so the path between two route points stays the path between those two points. The device may still calculate the route afresh when it loads the file.

There and Back in One File

To turn a one-way track into an out-and-back, reverse it with the timestamps removed, then load the original and the reversed file into the GPX Merger, original first. For the example the result is one track of 20 points and 13.67 km that runs from the trailhead to the camp and back, with 570 m of climb: the 450 out and the 120 home. The waypoints, which are in both files, are written once.

For a route you are still drawing, it is one click: Out & Back in the Route Planner adds the return along the same points.

Frequently Asked Questions

Does reversing change the distance?

No. The points are the same and so is the length of the line. Climb and descent swap.

Do I lose my waypoints, elevation, or heart rate?

No. Waypoints are kept exactly as they are, and each track point is moved whole, with everything written inside it.

Can I reverse one track and leave the others?

Yes. Untick the tracks and routes to leave alone. With several tracks, a further box puts them in the opposite order in the file as well, so a trip saved as a track a day runs backward from its last day.

Will reversing it twice give back the original?

Yes, if you choose Keep for the timestamps and leave the names alone: reversing the reversed example gives a file identical to the original, character for character.

What happens when I reverse a loop?

It starts and ends in the same place and runs the other way round. Everything above still applies: the climbs become descents and the turns flip.

Can my GPS reverse a route by itself?

Many units and apps can follow a saved course in the opposite direction. Where that works it saves making a file. Where it does not, or where you want to check the reversed line on a map first, reverse the file.

Is my file uploaded?

No. The file is read and reversed in your browser.

Related Tools and Guides