GPX ↔ GeoJSON Converter
Convert GPX files to GeoJSON and GeoJSON back to GPX. Waypoints, tracks, routes, elevation, and timestamps — all preserved. No data leaves your browser.
Drag & drop a .gpx or .geojson file, or paste your data directly.
What This Tool Does
Bidirectional conversion between GPX (GPS Exchange Format) and GeoJSON — the two most common open formats for GPS and mapping data.
coordTimes array on the GeoJSON feature. On round-trip, these are written back as <time> elements in each <trkpt>.coordTimes array.How to Use
_gpxType property added to GeoJSON features ('wpt', 'trk', 'rte') helps reconstruct the correct GPX element type on reverse conversion. Use Swap to test both directions.Logic Behind the Tool
How GPX structures map to GeoJSON features and back.
<wpt> → Point feature. Single-segment <trk> → LineString. Multi-segment <trk> → MultiLineString. <rte> → LineString. A _gpxType property ('wpt', 'trk', 'rte') is added to each feature so the original element type can be recovered on reverse conversion.Point → <wpt>. LineString → <trk> (or <rte> if _gpxType is 'rte'). MultiLineString → multi-segment <trk>. MultiPoint → multiple <wpt>. Polygons have no GPX equivalent and are skipped.lat/lon (latitude first). GeoJSON uses [longitude, latitude] (longitude first). The tool correctly maps these without swapping. Elevation is the <ele> element in GPX and the optional third value [lon, lat, ele] in GeoJSON coordinates.<time> values are stored as coordTimes arrays on GeoJSON features — a convention used by Mapbox and other tools. GPX metadata (author, link, bounds, copyright), waypoint links, and track extensions are discarded during conversion. Only geometry, names, descriptions, elevation, and timestamps are preserved.Frequently Asked Questions
GPX (GPS Exchange Format) is an open XML schema published by TopoGrafix in 2002. It became the standard way to exchange GPS data between devices and software. Every major GPS device brand (Garmin, Magellan, DeLorme), fitness app (Strava, Garmin Connect, Wahoo, AllTrails, Komoot), and mapping platform (Google Earth, OSMand, CalTopo) can export and import GPX. It's the ".mp3 of GPS formats" — not the most efficient, but the most universally compatible.
GeoJSON is the native format for web mapping. Leaflet, Mapbox GL JS, OpenLayers, Turf.js, deck.gl, and most web APIs expect GeoJSON. If you want to display a GPX track on a web map, analyze it with Turf.js, store it in a PostGIS database, or serve it from a REST API — you need GeoJSON. This converter handles the XML parsing and coordinate reordering so you don't have to.
Yes. GPX track point <time> elements are extracted and stored as a coordTimes array property on the GeoJSON feature. This follows the convention used by Mapbox, Turf.js, and other tools for attaching time data to LineString geometries. The array index corresponds to the coordinate array index. If some track points have no timestamp, those positions are stored as null in the array.
Yes. Use L.geoJSON(data).addTo(map) to add the converted GeoJSON to any Leaflet map. Points will appear as markers, LineStrings (tracks and routes) as polylines. For time-based track animation, consider the Leaflet.TimeDimension plugin which understands the coordTimes convention. For Mapbox, the GeoJSON source accepts the output directly.
Each <trk> element in the GPX file becomes a separate GeoJSON Feature in the output FeatureCollection. A track with a single <trkseg> becomes a LineString; a track with multiple segments becomes a MultiLineString. Similarly, each <wpt> and each <rte> becomes its own Feature. The FeatureCollection will contain one feature per GPX element.