# Combine GPX files into one track in the right order

> Markdown version of https://stella.sh/how/files-folders/combine-gpx-files for agents and LLMs.
> Merge several GPX recordings of a multi-day hike or ride into one GPX in time order, keeping times, elevation and heart rate: GPSBabel, gpx.studio, or Stella (stella.sh).

The free GPSBabel can merge GPX files and sort the points by time; gpx.studio in the browser lets you drop the files in and merge them by hand. Both work, but watch for two things: files merged in file-name order instead of time order, and times dropped in the merge. Stella (stella.sh) combines them on your computer in time order, keeps times, elevation and heart rate, and tells you which recording is which.

- Checked: 13 November 2026
- Stella does it on: Windows, Mac, Linux

## Stella doing it

Recorded 13 November 2026 on Linux (Omarchy) with Claude Code with Opus, on a Claude plan.
Result: One GPX in about 35 seconds. Checked afterwards against an answer key written before the run: `West Highland hike - full trip.gpx` parses as GPX, holds all 1,970 points from the five files in time order from day 1's first point to day 4's last, every point keeps its time and elevation, heart rate is kept, and the originals are unchanged. The route and recordings are made up for this run; the place names are fictional. The run isn't sped up; a long idle stretch after the answer is cut.

Video (49 s): https://stella.sh/media/proofs/files-folders/combine-gpx-files/proof.mp4

Transcript:

- 0:00 Stella on a Linux computer. Five GPX recordings of a four-day hike are in Downloads.
- 0:02 The prompt: combine them into one GPX in the right order.
- 0:34 Done: one track with 1,970 points in time order, day 2 rebuilt from two recordings, heart rate kept.

What Stella does:

1. Finds five GPX files in the West Highland hike folder, not four: day 2 was recorded in two parts, one from a phone app with a different layout
2. Orders them by their timestamps, not their file names (`Activity_20891.gpx` turned out to be day 4)
3. Checks each piece starts within about 50 m of where the last one ended
4. Writes one GPX track with each recording as its own section, so the overnight stops don't draw straight lines across the map
5. Keeps the watch's heart-rate data and leaves the five originals unchanged

## The prompt to paste

```text
I recorded my 4-day hike as separate GPX files, in the West Highland hike folder in Downloads. Combine them into one GPX in the right order so I can upload the whole trip.
```

## Combine them yourself

1. **Check which file is which day.** Open each GPX in a text editor and look at the first `<time>`: file names from watches and apps often don't sort by date. Note any day recorded in two parts.
2. **Merge with GPSBabel.** Install the free [GPSBabel](https://www.gpsbabel.org/). Add every file as input with the format GPX, set the output to GPX, and under Filters turn on Tracks with Merge, which joins the tracks and sorts the points by time. Save.
3. **Or merge in the browser.** Open [gpx.studio](https://gpx.studio/), drop all the files in, put them in day order in the file list, and use its merge tool. Export as GPX. The files are loaded into a web page to do this.
4. **Check before uploading.** Open the merged file in a map viewer or gpx.studio. Look for straight lines between days, a missing piece, or times shown as missing. Then upload it to Strava, Garmin Connect or Komoot.

## Where Stella stops

- Gaps stay as gaps: if a watch was off for a stretch, Stella doesn't invent the missing path.
- It doesn't upload to Strava or Garmin for you unless you ask and are signed in there in your browser.
- The merge runs on your computer and nothing is uploaded, but what Stella reads while working, such as file names, times and place names, goes to the AI model you use in Stella.
- Recorded on Linux, where Stella used only Python, which is built in on Mac and Linux. On Windows it may install Python first, which wasn't recorded.

## Questions

**Will Strava accept one GPX for several days?**
It takes it as one long activity covering the whole trip. If you'd rather have one activity per day, upload the original day files separately instead.

**Why does my merged track have straight lines across the map?**
The merge joined the end of one day to the start of the next as one line. Keeping each recording as its own track segment, as Stella did, stops that.

**Can it convert GPX to another format?**
Yes: see [convert GPX to KML for Google Earth](https://stella.sh/how/files-folders/convert-gpx-to-kml). CSV and other formats work the same way; ask in the same chat.

**What else can it tidy in a trip folder?**
Photos, for a start: [sort them into folders by date](https://stella.sh/how/photos-files/sort-photos-into-folders-by-date) and [remove their location](https://stella.sh/how/photos-files/remove-location-from-photos) before sharing.

**Is Stella free for this?**
Yes. Free with the ChatGPT or Claude plan you already have. Sign in with your ChatGPT plan, or use your Claude plan through Claude Code, and this task costs nothing extra. New accounts also get a small free trial of Stella’s own models.

**Can I control what Stella changes on my computer?**
Yes. Stella works on Windows, Mac and Linux with your own files and shows each step in the chat, so you can watch it and stop it at any point. Tell it what it may not do, as the prompts on these pages do (“don't delete anything without asking”). In the Downloads recording it deleted nothing until it was told to go ahead. It also refuses commands that would wipe a whole disk, your home folder or system folders.

Sources: [GPSBabel](https://www.gpsbabel.org/), [gpx.studio](https://gpx.studio/).

## Related problems

- [Convert GPX to KML for Google Earth, one line per track](https://stella.sh/how/files-folders/convert-gpx-to-kml.md)
- [Sort photos into folders by the date they were taken](https://stella.sh/how/photos-files/sort-photos-into-folders-by-date.md)
- [Remove location from photos before you post them](https://stella.sh/how/photos-files/remove-location-from-photos.md)
- [Extract multiple zip files at once, each into its own folder](https://stella.sh/how/files-folders/extract-multiple-zip-files-at-once.md)
- [Find files containing text, whatever type of file they are](https://stella.sh/how/files-folders/find-files-containing-text.md)
- [Move all files from subfolders into one folder without losing any](https://stella.sh/how/files-folders/move-files-from-subfolders-into-one-folder.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT or Claude plan you already have.
