How to Merge GPX Files: Free Tools & Methods (2026)

On this page
GPX files pile up fast. A multi-day hike becomes one file per day, a GPS watch can split a single run into multiple recordings, and waypoint collections often end up scattered across exports.
Merging GPX sounds simple, but the “right” approach depends on what you’re combining: tracks, waypoints, routes, or all of them together. Some tools also handle timestamps, segments, and metadata better than others.
Use the browser-based merger for a quick join, Python for automation, GPSBabel for command-line workflows, or a mapping application when you need to inspect the result visually.
What Is a GPX File?
GPX: GPS Exchange Format. XML-based file format for sharing GPS data between devices, mapping software, and fitness applications. TopoGrafix created it and publishes the GPX 1.1 schema.
GPX file contains three data types:
Tracks represent ordered sequences of GPS points recording where you've been. Each track contains one or more track segments with individual trackpoints. Trackpoints include latitude and longitude, while elevation and time are optional. Think of tracks as the breadcrumb trail a device records as you move.
Waypoints represent individual points of interest. Name, description, and coordinates. Like pins on a map, marking specific saved locations.
Routes represent planned paths consisting of ordered route points. Unlike tracks, which record where you actually went, routes represent where you intend to go.
Here's what a typical GPX file looks like under the hood:
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Garmin Connect"
xmlns="http://www.topografix.com/GPX/1/1">
<metadata>
<name>Morning Run</name>
<time>2026-06-10T07:30:00Z</time>
</metadata>
<trk>
<name>Morning Run</name>
<trkseg>
<trkpt lat="40.7128" lon="-74.0060">
<ele>10.5</ele>
<time>2026-06-10T07:30:00Z</time>
</trkpt>
<trkpt lat="40.7130" lon="-74.0058">
<ele>11.2</ele>
<time>2026-06-10T07:30:05Z</time>
</trkpt>
</trkseg>
</trk>
<wpt lat="40.7580" lon="-73.9855">
<name>Times Square</name>
<desc>Famous intersection in NYC</desc>
</wpt>
</gpx>Why Merge GPX Files?
There are many reasons to combine multiple GPX files into one:
Multi-day hikes where each day is recorded separately and you want the complete thru-hike in a single file. Cycling tours where you've recorded each stage individually. Split activities from a GPS device that lost signal or ran out of battery mid-workout. Waypoint collections from multiple scouting trips that you want consolidated into one master list. Separately planned route segments that need to become a single navigable route.
Sailing logs, road trip recordings, mountaineering expeditions with approach and descent tracks, or even geocaching waypoint lists from different regions can also require a merge.
If you work with GPS data regularly, you'll need to merge files at some point.
Method 1: Use the Free Online GPX Merger (No Code Required)
This is the simplest approach when you just want to combine GPX files quickly. Everything runs locally in the browser for privacy.
Try it here: www.merge-json-files.com/gpx-merger
How it works:
- Open the GPX merger page
- Drag and drop GPX files (or browse to select them)
- Choose a merge strategy:
- All elements: merge tracks, waypoints, and routes
- Tracks only: combine only track data
- Waypoints only: merge only saved locations
- Routes only: combine only routes
- Optionally enable Consolidate into single track to place the source track segments inside one new track
- Set a custom name (optional)
- Click Merge GPX Files
- Review statistics (tracks, waypoints, routes, points)
- Download the merged GPX
The merge runs locally using the browser, and it handles GPX 1.0 and 1.1 from common sources such as Garmin, Suunto, Coros, Apple Watch, Strava, Komoot, and AllTrails. This option is a good fit for small to medium batches when the main goal is a quick, clean combined file. It writes GPX 1.1 output with new file-level metadata, so verify the result if source metadata or root-level extensions matter to your workflow.
Method 2: Merge GPX Files Using Python
When you need automation or custom merge logic, Python with the gpxpy library is hard to beat.
Install gpxpy:
pip install gpxpyBasic GPX Merge Script:
import gpxpy
import glob
def merge_gpx_files(input_files, output_file):
"""Merge multiple GPX files into one."""
merged_gpx = gpxpy.gpx.GPX()
for filepath in input_files:
with open(filepath, 'r') as f:
gpx = gpxpy.parse(f)
# Copy tracks
for track in gpx.tracks:
merged_gpx.tracks.append(track)
# Copy waypoints
for waypoint in gpx.waypoints:
merged_gpx.waypoints.append(waypoint)
# Copy routes
for route in gpx.routes:
merged_gpx.routes.append(route)
# Write merged file
with open(output_file, 'w') as f:
f.write(merged_gpx.to_xml())
total_points = sum(
len(seg.points)
for track in merged_gpx.tracks
for seg in track.segments
)
print(f"Merged {len(input_files)} files")
print(f"Tracks: {len(merged_gpx.tracks)}")
print(f"Waypoints: {len(merged_gpx.waypoints)}")
print(f"Total points: {total_points}")
# Usage
files = sorted(glob.glob("./tracks/*.gpx"))
merge_gpx_files(files, "merged_trek.gpx")Advanced: Merge All Tracks into One Continuous Track
import gpxpy
import glob
def merge_into_single_track(input_files, output_file, track_name="Merged Track"):
"""Merge all GPX files into a single continuous track."""
merged_gpx = gpxpy.gpx.GPX()
merged_track = gpxpy.gpx.GPXTrack(name=track_name)
merged_segment = gpxpy.gpx.GPXTrackSegment()
for filepath in sorted(input_files):
with open(filepath, 'r') as f:
gpx = gpxpy.parse(f)
for track in gpx.tracks:
for segment in track.segments:
for point in segment.points:
merged_segment.points.append(point)
# Also copy waypoints
for waypoint in gpx.waypoints:
merged_gpx.waypoints.append(waypoint)
merged_track.segments.append(merged_segment)
merged_gpx.tracks.append(merged_track)
# Sort only when every point has a timestamp
if merged_segment.points and all(p.time is not None for p in merged_segment.points):
merged_segment.points.sort(key=lambda p: p.time)
with open(output_file, 'w') as f:
f.write(merged_gpx.to_xml())
print(f"Merged into single track: {len(merged_segment.points)} points")
# Usage
files = glob.glob("./daily_tracks/*.gpx")
merge_into_single_track(files, "complete_trek.gpx", "Pacific Crest Trail 2026")Remove Duplicate Waypoints:
def remove_duplicate_waypoints(gpx_data):
"""Remove waypoints with identical coordinates."""
seen = set()
unique_waypoints = []
for wpt in gpx_data.waypoints:
key = (round(wpt.latitude, 6), round(wpt.longitude, 6))
if key not in seen:
seen.add(key)
unique_waypoints.append(wpt)
gpx_data.waypoints = unique_waypoints
return gpx_dataPython gives you full control over merge logic with the ability to filter, sort, deduplicate, and even calculate statistics like distance and elevation gain. Capacity depends on available memory and source-file structure. The tradeoff is that it requires Python and gpxpy to be installed, and there's more setup involved compared to the online tool.
Method 3: Merge GPX Files with GPSBabel (Command Line)
GPSBabel is a free command-line tool built specifically for converting and manipulating GPS data files. It supports many GPS file formats, which makes it versatile.
Install GPSBabel:
- Windows: Download from gpsbabel.org
- macOS: brew install gpsbabel
- Linux: sudo apt install gpsbabel
Basic Merge:
gpsbabel -i gpx -f track1.gpx -i gpx -f track2.gpx -i gpx -f track3.gpx \
-o gpx -F merged.gpxMerge Only Tracks (Ignore Waypoints):
gpsbabel -t -i gpx -f track1.gpx -i gpx -f track2.gpx \
-o gpx -F merged_tracks.gpxMerge Only Waypoints:
gpsbabel -w -i gpx -f file1.gpx -i gpx -f file2.gpx \
-o gpx -F merged_waypoints.gpxRemove Duplicate Waypoints:
gpsbabel -w -i gpx -f file1.gpx -i gpx -f file2.gpx \
-x duplicate,location -o gpx -F merged_unique.gpxMerge All GPX Files in a Directory (Bash):
# Build the command as a Bash array so filenames stay quoted
CMD=(gpsbabel)
for f in ./tracks/*.gpx; do
CMD+=(-i gpx -f "$f")
done
CMD+=(-o gpx -F merged_all.gpx)
"${CMD[@]}"GPSBabel is purpose-built for GPS data, so it handles edge cases that generic tools miss. It has built-in filters for duplicate waypoints, track simplification, and more. The syntax can get verbose when you're working with many input files. Its GPX reader attempts to retain unfamiliar tags, but extension handling varies, so inspect device-specific fields after a merge.
Method 4: Merge GPX Files in Mapping Applications
Several mapping and GPS applications offer built-in merge capabilities:
Garmin BaseCamp: Import all your GPX files, select the tracks in the required order, and choose Join the Selected Tracks, then export the combined data as a new GPX file.
QGIS (Free GIS Software): Load the same GPX feature type from each file, such as tracks or waypoints, then run Merge vector layers from the Processing Toolbox. Export the resulting layer as GPX and repeat for other feature types if needed.
Online Alternatives: GPX Studio provides visual track editing and can combine loaded traces. AllTrails can export activities and routes as GPX; use one of the merge methods above to join those exports.
Comparison of GPX Merge Methods
Common Challenges When Merging GPX Files
Files from Different GPS Devices
Different devices record different data fields. A Garmin watch might include heart rate and cadence extensions, while a phone GPS app records only coordinates. Standard GPX elements are usually portable, but device-specific extensions appear only in data from the device that recorded them and may not survive every application or conversion. Decimal places indicate coordinate precision, not real-world GPS accuracy.
Timezone and Time Gap Issues
GPX time fields use XML Schema date-time values. A timestamp may end in Z for UTC or include a numeric offset, and some files omit time entirely. Compare normalized timestamps rather than displayed local times. Gaps between files are normal; if the time or location gaps are large, keep separate segments so mapping software can treat them as discontinuous spans.
Track Segment Breaks
Within a track,
Overlapping Tracks
If two GPX files cover the same route (like heading out and coming back on the same path), both tracks are preserved. The merger doesn't remove duplicates in track data. For waypoints, though, you can use deduplication to remove identical points.
Large File Sizes
GPX files with high-frequency recording (1-second intervals) can get big. A full day of 1-second recording produces roughly 86,400 points per track. A week-long trek can easily reach 500,000+ points across multiple files. Browser capacity depends on device memory, browser behavior, and GPX structure. If a batch becomes slow or fails, merge smaller groups or use Python or GPSBabel.
Best Practices for Merging GPX Files
- Name files sequentially. Date-based names like 2026-06-01_day1.gpx and 2026-06-02_day2.gpx sort naturally in the right order.
- Back up originals so it’s easy to re-merge with different settings.
- Choose the right strategy. Keep tracks separate for multi-day hikes, consolidate when an activity was accidentally split.
- Verify on a map. Import into Google Earth, Strava, Komoot, or another mapping tool to confirm everything looks right.
- Clean up obvious spikes or bad points before merging.
- Consider file size. Some devices struggle with huge tracks, so simplifying point density can help.
- Preserve metadata. Add a clear name and description so the merged file is still understandable later.
- Test with the target device before relying on it for navigation.
Real-World Merge Scenarios
Multi-Day Thru-Hike
For a long trek where each day is recorded separately, export the daily GPX files, merge them using the All elements strategy (to keep waypoints like rest stops), and avoid consolidating into a single track if separate days are easier to visualize. Upload the merged result to Strava, Komoot, or Google Earth to view the full route.
Accidentally Split Activity
If a watch battery dies mid-run and you end up with two recordings, merge the files and enable Consolidate into single track to create one continuous activity.
Waypoint Collection
When the goal is a master waypoint file, merge using Waypoints only and load the consolidated output onto the GPS device.
Working with GPX Files from Popular Platforms
Downloading GPX from Strava: Open the activity on the Strava website, click the three-dots menu, and select Export GPX.
Downloading GPX from Garmin Connect: Open the activity on the Garmin Connect website, click the gear icon, and select Export to GPX.
Downloading GPX from Komoot: Open a saved route or completed activity and choose Download GPX file. The export contains route geometry, but not planned waypoints, voice navigation, or Komoot maps.
Downloading GPX from AllTrails: Open the trail or recording, choose its export or download action, then select GPX Track or GPX Route where offered.
Frequently Asked Questions
Can I merge GPX files from different GPS devices?
Usually. GPX 1.0 and 1.1 share core concepts across devices, and the browser tool accepts either version when the file contains a track, route, or waypoint. Device extensions can differ, so verify sensor fields and navigation behavior in the destination application.
Will merging GPX files affect my distance calculations?
It can. The merge keeps source trackpoint coordinates and timestamps, but a destination app may recalculate distance. A single segment that joins distant endpoints can add the gap between them, which is why preserving segment breaks and reviewing the result on a map matters.
Can I merge hundreds of GPX files at once?
It depends on browser memory, file size, point count, and extension data. If a large browser batch stalls or fails, merge smaller groups or use Python with gpxpy or GPSBabel.
How do I merge GPX files on my phone?
Open the GPX merger in a mobile browser. It can work on iOS or Android when the browser's file picker exposes the GPX files, although a desktop is easier for large batches.
What happens to heart rate and cadence data?
GPX extensions such as heart rate, cadence, power, and temperature are vendor-specific. The browser tool carries child elements inside selected tracks, routes, and waypoints, but it creates new file-level metadata and consolidation creates a new track wrapper. If an extension is required, inspect the output in the destination app; gpxpy preserves GPX 1.1 extensions, while GPSBabel documents specific extension options and attempts to retain unfamiliar tags.
Final Thoughts
A good GPX merge comes down to choosing the right strategy (keep tracks separate vs consolidate) and always validating the result on a map before relying on it.
Related Guides: Learn more about working with data files in how to merge JSON files and how to split JSON files.
Read More
All Articles
6 Best GPX Editors and Viewers for Android in 2026
Compare the best GPX editors and viewers for Android for repairing tracks, inspecting elevation and sensor data, using offline maps, and navigating routes.

7 Best GPX Editors and Viewers for Mac in 2026
Compare the best GPX editors and viewers for Mac for repairing track points, planning routes, viewing elevation, using offline maps, and managing Garmin devices.

7 Best GPX Editors and Viewers for Windows in 2026
Compare the best GPX editors and viewers for Windows 10 and 11 for editing track points, planning routes, viewing elevation, using offline maps, and managing Garmin devices.