GPX is the format GPS devices export; GeoJSON (RFC 7946) is the lingua franca of web mapping libraries like Leaflet and Mapbox GL and desktop GIS like QGIS. This free converter turns one into the other in your browser, so you can put a recorded route on a web map or into a data pipeline without uploading your private location history.
How it works
The converter parses the GPX and emits a GeoJSON FeatureCollection:
DOMParserreads the GPX and finds everywpt,trkandrte.- Each waypoint becomes a
FeaturewithPointgeometry; itsname/descgo intoproperties. - Each track segment (
trkseg) and route is flattened into an ordered coordinate array and emitted as aLineStringfeature. - Coordinates are written as
[lon, lat, ele]— longitude first, the order RFC 7946 mandates — with elevation added as a third value when present.
The result is a single FeatureCollection, valid GeoJSON ready for any mapping tool.
Tips and example
A GPX waypoint <wpt lat="48.2082" lon="16.3738"/> becomes:
{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [16.3738, 48.2082] }, "properties": {} }
Note the reversed order: GeoJSON is [lon, lat], the opposite of how you usually say a coordinate aloud. A common mistake is feeding [lat, lon] into a map and seeing points land in the wrong hemisphere — this tool always writes longitude first.
Everything runs locally; your GPS data is never uploaded.
Using the GeoJSON output
Leaflet
In Leaflet, you can load the converted GeoJSON directly using L.geoJSON:
fetch("my-track.geojson")
.then(r => r.json())
.then(data => L.geoJSON(data).addTo(map));
This renders all features in the FeatureCollection automatically: waypoints appear as markers (Points) and tracks appear as polylines (LineStrings). You can pass a style function to L.geoJSON to control line color and weight.
Mapbox GL JS
In Mapbox, add the GeoJSON as a source and then create a layer for it:
map.addSource("route", { type: "geojson", data: "my-track.geojson" });
map.addLayer({ id: "route-line", type: "line", source: "route" });
Mapbox GL handles both Points and LineStrings in the same source; you use the layer’s filter property to address each geometry type separately.
QGIS and desktop GIS
QGIS can open GeoJSON files directly via Layer > Add Layer > Add Vector Layer. The file will import as a vector layer with the name and description properties from the GPX available as attributes in the attribute table.
The coordinate-order trap
GeoJSON requires [longitude, latitude] — the opposite of how coordinates are usually spoken or written. GPX stores lat and lon as named attributes, making it explicit. Many bugs in web mapping code arise from feeding GeoJSON point coordinates to a library that expects [lat, lon] (some older libraries default to this order). The standard [lon, lat] order is what RFC 7946 mandates and what this converter produces.
A symptom of a coordinate-order mix-up: your route appears in the ocean or in an unexpected location — often a mirror image of the correct location. If this happens in your mapping tool, check whether the library documentation specifies the coordinate order it expects.
Waypoints vs tracks vs routes in GPX
GPX defines three distinct data structures:
- Waypoints (
wpt) — individual named points: trailheads, summits, parking locations. Each becomes a GeoJSONPointfeature. - Tracks (
trk,trkseg,trkpt) — recorded GPS paths. A track can have multiple segments (for example, a route resumed after a device restart). Each segment becomes a separateLineStringfeature. - Routes (
rte,rtept) — planned paths (turn-by-turn navigation waypoints). Each route becomes aLineStringfeature.
All three are converted and included in the output FeatureCollection.