GPX to JSON Converter
Convert GPX files to structured JSON online. Parse tracks, waypoints, routes, elevation, and metadata from GPS Exchange Format instantly.
Awaiting GPX input...
About
GPX (GPS Exchange Format) is an XML schema for describing waypoints, tracks, and routes. Raw GPX is verbose and difficult to process programmatically. Incorrect parsing drops trackpoints, truncates elevation data, or silently ignores route segments. This converter uses the browser's native DOMParser to walk the full GPX document tree, extracting trkpt coordinates (latitude φ, longitude λ), elevation ele, timestamps, waypoints wpt, routes rte, and nested metadata into a clean JSON structure. It also computes track statistics: total distance via the Haversine formula, cumulative elevation gain and loss, and duration.
The tool handles multi-track and multi-segment GPX files conforming to GPX 1.0 and 1.1 schemas. Extension elements are preserved as generic key-value objects. Note: coordinate precision is limited to the source file's decimal places. Garmin, Strava, and Komoot exports are all valid inputs. Files exceeding 50 MB are rejected to prevent browser memory exhaustion.
Formulas
Distance between consecutive trackpoints is computed using the Haversine formula, which accounts for Earth's spherical geometry:
Where φ is latitude in radians, λ is longitude in radians, Δφ = φ2 − φ1, Δλ = λ2 − λ1, and R = 6371 km (mean Earth radius, WGS-84).
Elevation gain is the sum of all positive elevation differences between consecutive points: gain = n∑i=1 max(0, elei − elei−1). Elevation loss uses the same logic for negative differences. Average speed v = dtotaltelapsed, computed only when timestamps exist.
Reference Data
| GPX Element | XPath | JSON Output Key | Data Type | Description |
|---|---|---|---|---|
| Metadata Name | /gpx/metadata/name | metadata.name | String | Document title |
| Metadata Description | /gpx/metadata/desc | metadata.description | String | Document description |
| Metadata Author | /gpx/metadata/author/name | metadata.author.name | String | Creator name |
| Metadata Time | /gpx/metadata/time | metadata.time | ISO 8601 | Creation timestamp |
| Track | /gpx/trk | tracks[] | Array | Ordered collection of segments |
| Track Segment | /gpx/trk/trkseg | tracks[].segments[] | Array | Continuous sequence of points |
| Track Point | /gpx/trk/trkseg/trkpt | tracks[].segments[].points[] | Object | Single GPS fix with lat, lon |
| Elevation | trkpt/ele | point.elevation | Float (m) | Altitude above sea level |
| Timestamp | trkpt/time | point.time | ISO 8601 | UTC time of fix |
| Waypoint | /gpx/wpt | waypoints[] | Object | Named POI with coordinates |
| Waypoint Name | wpt/name | waypoint.name | String | Waypoint label |
| Waypoint Symbol | wpt/sym | waypoint.symbol | String | Icon identifier |
| Route | /gpx/rte | routes[] | Array | Ordered list of route points |
| Route Point | /gpx/rte/rtept | routes[].points[] | Object | Planned navigation point |
| Extensions | */extensions/* | *.extensions | Object | Vendor-specific data (HR, cadence, power) |
| Heart Rate (Garmin) | extensions/hr | point.extensions.hr | Integer (bpm) | Heart rate from chest strap or watch |
| Cadence | extensions/cad | point.extensions.cad | Integer (rpm) | Pedaling or step cadence |
| Power | extensions/power | point.extensions.power | Integer (W) | Cycling power meter output |
| Bounds | /gpx/metadata/bounds | metadata.bounds | Object | Bounding box: minlat, maxlat, minlon, maxlon |
| Link | /gpx/metadata/link | metadata.link | Object | URL with text and type attributes |