How to Merge Two GPX Files Into One Activity
Your ride is done. Your training log should show one long ride. But it shows two short ones, because your watch or bike computer stopped halfway and started a new file. It is one of the most common file problems in sport, and it has a clean fix: merge the two GPX files into one activity.
A GPX file is a list of points. Each point has a place on the map, a height, and a time stamp. When you merge two GPX files, you put the points of both files into one list, in time order. The ride stays the same. The split goes away.
This guide walks through the whole job. You will learn how to check both files first, how the join works, what can go wrong, and how to prove at the end that no part of your ride was lost. The same steps work for runs, hikes, and swims that were saved as GPX.
One point before we start: a merge is only as good as the files you feed it. If the second file came from a second device that ran at the same time as the first, you do not want a join in time order. You want a stream-by-stream merge. That case has its own guide on how to combine files from two devices. Here, we deal with the plain case: one ride, saved in two parts, back to back.
Why one ride ends up as two files
Devices split rides for dull reasons. The battery dies. The unit locks up and restarts. You press stop at a café, and the watch saves the ride and starts a fresh one when you roll out. A long event may be saved one leg at a time. None of this is your fault, and none of it harms the data. Each file is a true part of the ride.
The harm is in how the split looks later. Your log counts two short rides in place of one long one. Your weekly miles still add up, but your longest ride, your pace trend, and your route map all tell the wrong story. A race file split in two can even look like two starts on the same day.
Merging fixes the story. It joins the parts end to end, the way you rode them. Total time, total miles, and total climb are worked out again from the joined points, so the one file tells the truth about the whole ride.
Finding the parts is its own small job. Devices name files by date and time, and the two parts of one ride sit side by side in the list: same day, start times hours apart at most. If you sync through an app, export both files fresh rather than trusting an old download folder. A stale folder is how last week's ride sneaks into this week's merge. Check the start date on each file as you pick it — the health check shows it in plain text, and ten seconds of reading here saves the whole job.
One more case is worth naming: the ride that was paused, not split. Some units hold a long pause inside one file, as a gap between segments. That file is already whole. It needs no merge, and joining it to a twin of itself would double the ride. If the history on your device shows one entry, trust it: one entry, one file. Merges are for the rides that show as two.
What a merge does, step by step
A merge tool does four plain things. None of them changes your ride. They change only how the ride is stored.
| Step | What happens | Why it matters |
|---|---|---|
| Read | Both files are read point by point | Damage and gaps show up here, not later |
| Sort | All points are put in time order | The joined file flows like the real ride |
| Join | The parts are written as one track | One start, one end, one set of totals |
| Check | Points in and points out are counted | You can prove nothing was lost |
Note what the merge does not do. It does not smooth your line on the map. It does not fill gaps with made-up points. If you stopped for ten minutes at a café, the joined file still shows a ten-minute jump from the last point of part one to the first point of part two. That is honest data, and it is what you want.
Before you merge: a two-minute check of both files
Open each file on its own first, or run it through a health check. You want four facts about each file: how many points it has, when it starts, when it ends, and which data streams it holds — position, height, heart rate, cadence, power, and heat (temperature). FitMerge shows all of this for each file before you merge, for free.
Two checks matter most. First, the end of file one should sit close to the start of file two. A gap of a few minutes is a café stop. A gap of a day means the files are not parts of the same ride. Second, the point counts should look sane. A three-hour ride with 40 points was saved with a very slow rate, or it is not the file you think it is.
Keep a copy of both raw files in a safe place. A merge writes a new file; it should never touch the old ones. But copies cost nothing, and they are your way back if you pick the wrong pair of files. Pros who work with race files keep the raw set for every event, for this one reason.
A word on segments, since GPX files hold them. One GPX track can be made of many segments — one per pause, in many devices' way of writing. Segments are fine. A sound merge keeps each file's segments in order and lays the files end to end. What you should not do is split a file by hand at a segment line and treat the parts as rides. The totals live at the file level, and a hand-cut part has no totals of its own. Let the tool read whole files and do the join at that level.
Also note what the health check cannot see. It reads what is in the file: points, times, streams. It cannot know that you stopped for a flat and walked a mile with the watch off, or that the second file began in a car. Gaps in the record are honest. If a gap looks wrong to you, it is a fact about the ride, not a fault in the file — and a merge will carry it through as it should.
How to merge the files
In FitMerge, the flow is short. Upload both GPX files on the merge tool and read the health check for each one. Pick the mode called stitch in time order. The tool lines the files up by their time stamps and writes one GPX file with all the points of both. Download it, and look at the totals block that comes with it.
You can also join GPX files by hand in a text editor, since GPX is plain text in XML form. In truth, we do not advise it for real rides. One track may hold many segments, the time stamps use a set form, and a single bad tag can make the whole file fail to load. A tool that reads and writes the format does the same job with far less risk.
Order counts, but time stamps do the work. If you drop the files in the wrong order, a good tool still sorts the points by time. The start of your ride is the point with the first time stamp, no matter which file held it. What you must get right is the pair: both files, and no third file that belongs to a different ride.
What can go wrong
Four faults cause most bad merges. The first is overlap: the two files cover some of the same minutes. This can happen when a device restarts and re-saves the tail of the ride. A plain stitch will then count those points twice. If the health check shows the files overlap in time, use the stream merge mode, or trim one file first.
The second fault is a clock gap. One file may use UTC and the other local time if they came from two apps. The sort then puts hours of points in the wrong place. The map gives it away at once: the track jumps across the world and back. The fix is to set both files to the same clock base before you merge.
The third fault is missing time stamps. Some route files hold points with no time at all — they are drawn routes, not rides. A time-order merge has nothing to sort by. Those files can still be joined as a route, but they will not form a true activity with pace and speed. The fourth fault is a plain wrong file: last week's ride looks a lot like this week's in a list. The start date in the health check is your guard. Read it.
Elevation deserves its own line in this list. Two files can hold height from two sources — GPS height in one, a barometer in the other — and the joined file may show a step at the seam, a sudden jump of ten or twenty meters that you never climbed. It is a data seam, not a cliff. Most platforms smooth height or recount climb in their own way, so the step rarely hurts your totals. But if your climb number looks wild, look at the seam first before you doubt the whole file.
And a note on file size, since riders ask: a merged GPX is bigger than each part and smaller than you fear. GPX is text, and text is fat — a long ride can run to many megabytes. That is normal for the form. If you must mail the file or a tool caps the size, the FIT form of the same ride is far more compact, one more reason the output form is worth a thought at download time.
After the merge: check the new file
Do not delete the two old files until the new one passes three checks. The point count of the merged file should match the sum of the two counts you wrote down, or be less by a count you can explain — points dropped at a join, for one. The start and end times should match the true start and end of your ride. And the map should show one clean line, not a star of jumps. We wrote a full guide on this habit for TCX files: how to check merged totals, points, and stream coverage.
If the merged file will go to a training platform, one more choice helps. Platforms read GPX, but the full stream set rides best in FIT. If your parts held heart rate or power, read FIT vs GPX vs TCX: which format keeps your data before you pick the output form. And if your two parts came from a ride you plan to share as one Strava activity, the upload steps are in how to merge two Strava activities into one.
The short version
Two files, one ride: check both files, join them in time order, and count the points on the way out. Do that, and the merged file is the ride you did — whole, in order, and safe to upload. Merge your two files now — the health check and the GPX merge are free, and the totals block shows the count proof with every download.
Sources and further reading
- GPS Accuracy — GPS.gov — The U.S. government's own page on how exact GPS fixes are, and what makes them drift.
- GPS and Telling Time — GPS.gov — Why GPS clocks are so exact, and how devices use them to stamp each point in time.
- Physical Activity Guidelines: Current Guidelines — health.gov — The current U.S. guidelines for weekly activity — the base your training log is built on.