How to split a GPX file into two tracks
A single GPX file sometimes holds more than one walk that really belongs as two. The recording never got stopped between a morning loop and an afternoon errand, a multi-day trek came out as one long file rather than a day-by-day set, or an out-and-back would just be easier to look at as two separate legs. Splitting a GPX file means cutting the ordered list of points at one spot and writing what comes after that spot into a second file. Here is what that actually involves, and what it does and does not change.
The short answer
A GPX track is an ordered list of timestamped points inside a track element. Splitting one into two means choosing a point partway through, closing off the first file's track at that point, and starting a second file whose track begins with everything from there onward. Nothing about the coordinates or timestamps changes — only how many files they are divided across. A short recording is small enough to split by hand in a text editor; a long one is easier with a tool built for GPS data.
Why one file ends up needing to become two
The most common cause is simply forgetting to stop a recording. A morning walk finishes, the app keeps running through lunch and an errand, and a second walk that afternoon gets appended to the same file as an unrelated first one — two separate outings sitting inside a single track with a long, uneventful gap in the middle.
A multi-day trek can end up the opposite way: recorded as one continuous file across several days rather than stopped and restarted each night, which is fine while it is happening but awkward afterwards if a service or a personal archive expects one file per day. And some people simply prefer an out-and-back walk shown as two legs — the way out and the way back — rather than one line that quietly doubles back on itself.
None of these are things a file is "wrong" for containing. They are just cases where a single recording covers more ground, or more time, than is useful to treat as one unit afterwards.
How to actually split it
A tool built for GPS data
Browser tools such as GPX Studio can load a file, show the track on a map, and let you pick a point to cut it at, exporting the two halves as separate files without any hand-editing of the XML. GPSBabel, a free command-line tool for converting and manipulating GPS data, can split a file at a given point or time in a single command if a terminal is comfortable territory. QGIS can do the same as part of a broader GIS workflow, which pays off once splitting is a repeated task rather than a one-off.
By hand, for a file small enough to read
Because GPX is plain text, a short file can be split with nothing more than a text editor. Find the track point where the cut should fall, then everything from that point onward gets removed from the first file and pasted into a second file that repeats the same opening structure — the XML declaration, the <gpx> tag and its attributes, and a fresh <trk> and <trkseg> to hold the remaining points. Both files need their own valid opening and closing tags; a split that just chops a file in half partway through the XML, rather than at a clean point boundary, produces two files that do not open at all.
Picking where to cut
The best cut point is a real stop, not an arbitrary point count. If the file already has a gap in its timestamps — a pause between two activities, or a segment break where the original recording was interrupted — that gap is usually the natural place to divide it, because it means neither resulting file has a stretch of standing-still time stitched onto the end of a walk it was not really part of. Cutting mid-stride, in the middle of continuous movement, is still possible but leaves each half missing context the other one has: a distance and duration that only make sense read against the whole original file.
What splitting fixes, and what it does not
Splitting solves the "two walks, one file" problem: a service that a file gets uploaded to reports two separate distances, two separate durations and two separate elevation profiles instead of one combined figure that quietly blends an unrelated errand into a hike, or blends the outbound and return legs of a walk into a single number that hides how each half went.
It does not retroactively clean up anything inside either half. Noise in the elevation data, a wandering line under tree cover, a GPS spike while standing still — whatever was already in the points stays exactly as it was, just divided between two files instead of held in one. Splitting changes how many files the data lives in, not the quality of the data itself.
Work on a copy, keep the original
Split a duplicate of the file, not the only copy that exists. A hand edit that goes wrong — a tag closed in the wrong place, a header copied incompletely into the second file — is easy to fix by starting again from an untouched original, and much harder to fix if that original was the file being edited.
Where TrailCam fits in
TrailCam keeps each recording as its own separate entry in your history from the moment you start and stop it, rather than one running file that different walks get appended to, so most of the reasons to split a file after the fact never come up. It can export a single route or your entire history at once, as GPX 1.1 or as a CSV summary. Export is part of the optional TrailCam Pro upgrade; the app itself is free to download.
Questions
- Does splitting a GPX file lose any of the original data?
- No, as long as every point ends up in one file or the other. Splitting only decides which file a point belongs to; the coordinates, elevation and timestamps themselves are untouched.
- Can I split a GPX file without installing anything?
- For a short file, yes — it is plain text XML, so a built-in text editor can do it. For a long file with thousands of points, a tool built for GPS data, such as GPX Studio in a browser, is far less error-prone than doing it by hand.
- Do the two resulting files need their own names?
- It is worth giving each one its own <name> inside the file, and a sensible filename, so a service you upload them to does not show two activities both called by the original file's name. Neither name has any effect on the coordinates.
Recording your own routes
TrailCam is an iPhone app that records your route with GPS, keeps video clips, photos and voice notes pinned to the spot where you took them, and exports the result as GPX 1.1 or CSV. It is free to download.