Merge & Combine GPX Files Online
Want to see your entire trip in one map? This GPX merger lets you combine separate GPS tracks and waypoints from multiple rides or hikes into one master file. It keeps your timestamps and elevation data synced, so you can upload a single, complete track to Strava or Garmin Connect.
Drop GPX files or click to browse
Supports tracks, waypoints, and routes
Want to test drive the tool?
Before & After
Combine fragmented tracks
<!-- ride_part_1.gpx -->
<trk>
<name>Morning Ride Pt 1</name>
<trkseg>
<trkpt lat="45.523" lon="-122.676"><ele>15.2</ele></trkpt>
<trkpt lat="45.524" lon="-122.677"><ele>15.5</ele></trkpt>
</trkseg>
</trk>
<!-- ride_part_2.gpx -->
<trk>
<name>Morning Ride Pt 2</name>
<trkseg>
<trkpt lat="45.525" lon="-122.678"><ele>16.1</ele></trkpt>
</trkseg>
</trk><trk>
<name>Morning Ride (Merged)</name>
<trkseg>
<trkpt lat="45.523" lon="-122.676"><ele>15.2</ele></trkpt>
<trkpt lat="45.524" lon="-122.677"><ele>15.5</ele></trkpt>
<trkpt lat="45.525" lon="-122.678"><ele>16.1</ele></trkpt>
</trkseg>
</trk>How It Works
Clean and simple process
Upload GPX
Drag and drop .gpx files or click to browse. Supports all standard GPS devices.
Select Tracks
Choose which tracks, routes, or waypoints to include in the final merge.
Combine Data
Consolidate points into single continuous tracks or keep them separate.
Download File
Get a perfectly formatted GPX file ready for Strava, Garmin, or Google Earth.
GPX Format Comparison
How GPX measures up
| Feature | GPX | KML | GeoJSON | FIT |
|---|---|---|---|---|
| Primary Use | GPS data exchange | Map visualization | Web mapping | Fitness devices |
| Created By | TopoGrafix | IETF / GeoJSON WG | Garmin (ANT+) | |
| Format | XML | XML | JSON | Binary |
| Tracks / Routes | Yes | Yes (LineString) | Yes (LineString) | Yes (Records) |
| Waypoints | Yes | Yes (Placemarks) | Yes (Point) | No |
| Timestamps | Per track point | Via TimeStamp | Not built-in | Per record |
| Fitness Data (HR, cadence) | Via extensions | No | No | Native support |
| Human-Readable | Yes | Yes | Yes | No (binary) |
| File Size | Medium | Medium-Large | Small-Medium | Very small |
| Best For | Hiking, cycling, GPS sharing | Google Earth, visual maps | Web apps, APIs | Garmin watches, bike computers |
Use Cases
GPS track consolidation
Multi-Day Hiking
Combine daily GPS logs from thru-hikes or backpacking trips into a single continuous track showing your entire journey on one map.
Broken Recording Fix
Stitch together tracks from a paused or restarted recording. Fix battery deaths mid-ride by merging the two halves back into one activity.
Waypoint Collection
Compile waypoints from multiple scouting sessions into a master POI file. Perfect for fishing spots, campsites, or geocache locations.
Race Route Planning
Merge separate route segments into a complete race course. Combine reconnaissance rides into one file for event organizers and participants.
Key Features
Built for performance
Smart Consolidator
Stitch broken tracks together into a single continuous activity.
Selective Merging
Extract and merge just waypoints, tracks, or segments.
Data Preservation
Elevation, timestamps, and fitness data are perfectly preserved.
Programmatic Merge
Python and CLI
import gpxpy
import glob
merged = gpxpy.gpx.GPX()
for filepath in sorted(glob.glob("day_*.gpx")):
with open(filepath, "r") as f:
gpx = gpxpy.parse(f)
for track in gpx.tracks:
merged.tracks.append(track)
for waypoint in gpx.waypoints:
merged.waypoints.append(waypoint)
for route in gpx.routes:
merged.routes.append(route)
with open("merged_trip.gpx", "w") as f:
f.write(merged.to_xml())
print(f"Merged {len(merged.tracks)} tracks, "
f"{len(merged.waypoints)} waypoints, "
f"{len(merged.routes)} routes")# Merge multiple GPX files using gpsbabel (CLI)
# Install: sudo apt install gpsbabel (Linux)
# brew install gpsbabel (macOS)
# Merge two GPX files, keeping all tracks and waypoints
gpsbabel -i gpx -f day1.gpx -i gpx -f day2.gpx -o gpx -F merged.gpx
# Merge an entire folder of GPX files
gpsbabel \
-i gpx -f morning_ride.gpx \
-i gpx -f afternoon_ride.gpx \
-i gpx -f evening_walk.gpx \
-o gpx -F full_day.gpxFAQ
Common questions
Related Articles
Related Articles

How to Merge GPX Files: The Complete Step-by-Step Guide
Learn how to merge multiple GPX files into one using a free online tool, Python, GPSBabel, and command-line methods. Covers combining GPS tracks, waypoints, routes from Garmin, Strava, Komoot, and other GPS devices.

How to Merge Multiple JSON Files: Step-by-Step Guide
Learn how to merge multiple JSON files into one using our free online tool, Python scripts, JavaScript, and command-line jq. Supports nested JSON and large datasets. Step-by-step guide for developers and data engineers.

How JSON Powers Everything: The Hidden Force Behind Modern Web Applications
Learn how JSON powers modern web applications, APIs, and online tools. Discover why JSON became the universal data format and how it enables everything from file converters to real-time applications.
Complete Guide
In-depth walkthrough
GPX file merging addresses GPS data consolidation requirements when activities span multiple recording sessions or devices. Multi-day adventures, device battery limitations, and cross-platform tracking scenarios generate fragmented GPX files that require consolidation for complete route analysis.
Combining GPX tracks enables comprehensive GPS data merging for route visualization, performance analysis, and sharing complete activity records across fitness and mapping platforms.
Introduction to GPX Files and GPS Data
GPX (GPS Exchange Format) serves as the standard XML-based format for GPS data interchange across fitness devices, mapping applications, and tracking platforms including Garmin, Strava, and outdoor navigation systems.
GPX files contain structured XML elements for tracks (recorded paths), routes (planned paths), and waypoints (specific geographic locations) with timestamps, elevation data, and metadata.
GPS data fragmentation occurs when activities exceed device battery life, span multiple days, or involve platform switching between devices during continuous activities requiring subsequent file consolidation.
Common consolidation scenarios include multi-day hiking expeditions, ultra-distance cycling events, and expedition tracking where complete route visualization requires merging individual daily or device-specific GPX recordings.
This guide covers what GPX files contain, when to merge them, and how to do it correctly. The tool above is ready to use.
Why Merge GPX Files?
Here are real-world situations where GPX merging is useful:
- Multi-Day Adventures: Combine daily GPS logs from multi-day hiking, cycling, or backpacking trips into a single comprehensive track showing the entire journey.
- Device Switching: When you switch between GPS devices mid-activity (e.g., phone dying and switching to a watch), merge the resulting separate files into one continuous track.
- Route Planning: Combine segments of different routes to create a new custom route for upcoming adventures or group activities.
- Activity Consolidation: Merge GPS data from multiple activities on the same day (morning run + afternoon hike) into a single day's record.
- Waypoint Collection: Combine waypoint files from multiple scouting sessions into a master file of points of interest.
- Data Analysis: Create unified datasets for elevation profiling, distance calculations, or comparative analysis across multiple tracks.
- Map Visualization: Merge multiple tracks for display on a single map view in applications like Google Earth, CalTopo, or GaiaGPS.
Understanding GPX File Structure
GPX files are XML documents with a well-defined structure. Understanding the components helps you make better decisions when merging.
- Tracks (trk): The most common element—recordings of where you've been. Tracks contain track segments (trkseg) which hold individual track points (trkpt) with latitude, longitude, elevation, and timestamp data.
- Routes (rte): Planned paths consisting of route points (rtept). Unlike tracks which record actual movement, routes represent intended navigation paths with turn-by-turn waypoints.
- Waypoints (wpt): Individual points of interest with coordinates and optional metadata like name, description, elevation, and symbol type. Used for marking campsites, trailheads, viewpoints, etc.
- Metadata: File-level information including name, description, author, creation time, and bounds. When merging, our tool generates new metadata that reflects the combined dataset.
Each track point stores essential GPS data: latitude and longitude coordinates, elevation above sea level, timestamp, and optional extensions for heart rate, cadence, temperature, or power data depending on the recording device.
GPS File Format Comparison
GPX is not the only GPS file format out there. Depending on your device and use case, you may encounter KML, GeoJSON, or FIT files.
Here is how they stack up against each other so you can decide when GPX is the right choice and when you might need to convert.
| Feature | GPX | KML | GeoJSON | FIT |
|---|---|---|---|---|
| File Extension | .gpx | .kml / .kmz | .geojson | .fit |
| Underlying Format | XML | XML | JSON | Binary (protobuf-like) |
| Track Support | Native (trk) | LineString / gx:Track | LineString | Record messages |
| Waypoint Support | Native (wpt) | Placemark / Point | Point geometry | Not supported |
| Elevation Data | Per track point (<ele>) | Via coordinates (3rd value) | Via coordinates (3rd value) | Per record (enhanced_altitude) |
| Timestamp Precision | ISO 8601 per point | ISO 8601 via TimeStamp | Not standardized | Millisecond-level per record |
| Heart Rate / Cadence | Via Garmin extensions | Not supported | Not supported | Native fields |
| Typical File Size | Medium | Medium to large | Small to medium | Very small (binary) |
| Primary Ecosystem | Garmin, Strava, Komoot | Google Earth, Maps | Leaflet, Mapbox, web APIs | Garmin, Wahoo, Zwift |
For most outdoor activities and cross-platform sharing, GPX remains the best choice. It strikes the right balance between human readability, broad tool support, and the ability to store tracks, waypoints, and routes in a single file.
FIT is better for raw fitness data, while KML and GeoJSON shine in web visualization workflows.
Benefits of an Online GPX Merger Tool
Many people try merging GPX files by opening them in a text editor and pasting the XML together. That approach works until it doesn't.
A proper GPX merger tool offers several advantages:
- No Software Required: Works directly in your browser—no need to install GIS software like QGIS, desktop applications, or command-line tools.
- Smart XML Parsing: Automatically parses and validates GPX XML structure, ensuring the merged output is a properly formatted GPX file.
- Selective Merging: Choose to merge all elements, or selectively include only tracks, waypoints, or routes based on your needs.
- Track Consolidation: Optionally merge all tracks from multiple files into a single continuous track for seamless visualization.
- Browser-Based Privacy: All processing happens locally in your browser. Your GPS data and location information are never uploaded to any server.
- Statistics Overview: View merge statistics including total tracks, waypoints, routes, and data points to verify your merge results.
- Cross-Platform: Works on any device—Windows, Mac, Linux, or mobile—with a modern web browser.
Step-by-Step: Merging Multiple GPX Files
Follow these simple steps to merge GPX files quickly and accurately:
Step 1: Export Your GPX Files
Download GPX files from your GPS device, fitness app (Strava, Garmin Connect, Komoot), or mapping software. Most platforms offer GPX export in their activity or route settings.
Step 2: Upload Your GPX Files
Drag and drop your GPX files into the merger tool, or click to browse and select files from your device. Upload as many files as needed.
Step 3: Configure Merge Options
Optionally expand advanced options to choose your merge strategy (all elements, tracks only, waypoints only, or routes only). Enable "Merge All Tracks Into One" for a continuous track, and set a custom track name if desired.
Step 4: Merge and Download
Click the merge button to combine all files. Review the statistics summary and preview the merged XML content. Download the result as a single GPX file ready for import into any mapping application.
Merge GPX Files with Code
If you prefer a programmatic approach or need to merge GPX files as part of an automated pipeline, here are two reliable methods.
The Python approach uses the popular gpxpy library, while the command-line approach uses gpsbabel, a battle-tested GPS data converter.
Python with gpxpy
Install with pip install gpxpy
import gpxpy
import glob
# Parse and merge all GPX files in a directory
merged = gpxpy.gpx.GPX()
for path in sorted(glob.glob("tracks/*.gpx")):
with open(path, "r") as f:
gpx = gpxpy.parse(f)
for track in gpx.tracks:
merged.tracks.append(track)
for wpt in gpx.waypoints:
merged.waypoints.append(wpt)
# Write the combined result
with open("merged_output.gpx", "w") as out:
out.write(merged.to_xml())
print(f"Done: {len(merged.tracks)} tracks, "
f"{len(merged.waypoints)} waypoints")Command Line with gpsbabel
# gpsbabel: the Swiss Army knife for GPS data
# Install: sudo apt install gpsbabel | brew install gpsbabel
# Basic merge of two GPX files
gpsbabel -i gpx -f ride_part1.gpx \
-i gpx -f ride_part2.gpx \
-o gpx -F combined_ride.gpx
# Merge + sort all points by timestamp
gpsbabel -i gpx -f morning.gpx \
-i gpx -f afternoon.gpx \
-x sort,time \
-o gpx -F sorted_day.gpxAdvanced Merge Options Explained
Our GPX merger offers several advanced options for fine-tuning your merge:
- Merge Strategy: Choose what to include in the output—everything (tracks, waypoints, and routes), or only specific element types. Use "Tracks Only" for activity-focused merging, or "Waypoints Only" to consolidate points of interest.
- Merge All Tracks Into One: Instead of keeping tracks from each file separate, combine all track segments into a single track element. This creates a continuous track that apps display as one activity rather than multiple.
- Custom Track Name: When merging tracks into one, specify a custom name for the combined track (e.g., "PCT Section A-C" or "Summer Tour 2025").
- Preserve Timestamps: Keep original timestamp data from each track point. This is important for maintaining accurate timing, pace, and speed data in fitness applications.
Best Practices for GPX File Merging
Follow these best practices to ensure optimal results when merging GPX files:
- Verify Source Data: Open each GPX file in a mapping app before merging to ensure they contain the expected tracks and are free of GPS glitches or erroneous data points.
- Consider Chronological Order: When merging tracks from sequential activities, upload files in chronological order for logical track arrangement in the merged output.
- Use Selective Merging: If you only need tracks, use the "Tracks Only" strategy to keep the output clean and avoid importing unwanted waypoints from other files.
- Keep Originals: Always retain your original GPX files. The merge is non-destructive, but having originals allows you to re-merge with different settings or correct errors.
- Test the Output: After merging, import the resulting GPX file into your preferred mapping application to verify the tracks display correctly and all data is intact.
- Mind File Size: Very large GPX files with millions of track points may be slow to process in some mapping applications. Consider whether you truly need every point at maximum resolution.
Common Use Cases for Merging GPX Files
GPX file merging serves numerous practical applications across outdoor activities and professional GPS workflows:
- Thru-Hiking: Combine daily track logs from long-distance trails like the Appalachian Trail, Pacific Crest Trail, or Camino de Santiago into a complete through-hike record.
- Cycling Tours: Merge daily ride tracks from multi-day bike tours or bikepacking trips into comprehensive route documentation.
- Running Training: Consolidate weekly or monthly running tracks to analyze training routes and coverage over time.
- Sailing and Boating: Combine GPS logs from ocean passages, river trips, or lake sailing sessions into voyage records.
- Surveying and Fieldwork: Merge GPS data collected across multiple field sessions for environmental surveys, archaeological digs, or geological mapping.
- Geocaching: Combine waypoint files for geocache locations across different regions or hunting sessions.
- Drone Operations: Merge flight path GPX files from multiple drone missions for coverage mapping and flight log documentation.
- Fleet Management: Combine vehicle GPS tracks for route analysis, fuel optimization, and driver accountability reporting.
Troubleshooting Common Issues
If you encounter issues while merging GPX files, here are solutions to the most common problems:
- File Won't Upload: Ensure the file has a .gpx extension and contains valid XML. Some exported files may use .xml extension—rename them to .gpx.
- "Invalid GPX File" Error: The file may contain malformed XML. Open it in a text editor to check for encoding issues or truncated content. Some devices create corrupted files when battery dies mid-recording.
- Missing Tracks After Merge: Check your merge strategy setting. If set to "Waypoints Only", tracks will be excluded from the output.
- Tracks Show as Separate Activities: Enable the "Merge All Tracks Into One" option to combine tracks into a single continuous track element.
- Large File Performance: Very large GPX files (50MB+) may take longer to process. Be patient or try merging in smaller batches.
Conclusion
Merging GPX files can be complex when done manually in a text editor due to XML nesting, duplicate metadata blocks, and mismatched track segments.
This tool handles the XML processing for stitching together multi-day tours, combining tracks from devices with dead batteries, or building master waypoint files.