Home
Convert GPX to Other Formats

How to Convert GPX to KML, GeoJSON and Other Formats

A free GPX converter that runs in your browser: turn GPX into KML, KMZ, GeoJSON, TCX or CSV, see what each app wants, what survives and how to fix errors.

TrailX

9 min read

–
A handheld GPS unit showing elevation, trip distance and moving time, held up outdoors at dusk in Joshua Tree National Park
Photo: Tony Webster / Wikimedia Commons, CC BY 2.0
On this page
  1. 01Which format does your app want?
  2. 02How to use the TrailX GPX converter, step by step
  3. 03What gets kept and what gets lost
  4. 04GPX to KML or KMZ for Google Earth and My Maps
  5. 05GPX to GeoJSON for web maps, QGIS and developers
  6. 06GPX to TCX for fitness and training platforms
  7. 07GPX to CSV for spreadsheets
  8. 08Common errors and how to fix them
  9. 09Skip the converter: export from trail pages and the app
  10. 10Where to next?

GPX is the format almost every GPS device and outdoor app understands, so it's usually the file you end up holding. Then you want to show the route in Google Earth, drop it onto a web map, load it into a training platform or open it in a spreadsheet, and suddenly GPX is the wrong shape. A GPX converter fixes that in a few seconds, as long as you know which format each tool expects and what the conversion leaves behind.

This post walks through converting GPX to KML, KMZ, GeoJSON, TCX and CSV with our free in-browser tool, which format suits which app, and the handful of errors we see most often. If you're going the other way (Google Earth to your GPS), we've covered that separately in converting KML or KMZ to GPX.

Which format does your app want?

Start with where the file is going:

You want to...Convert GPX toWhy
View the route in Google Earth or share it via Google My MapsKML or KMZGoogle's own formats; KMZ is just a zipped KML
Put the route on a website, or open it in QGIS or another GIS toolGeoJSONThe native format of web mapping libraries and most GIS software
Load a course into a fitness or training platform that asks for itTCXGarmin's Training Center format, still preferred by some platforms
Analyse points in Excel, Google Sheets or a scriptCSVOne row per point, easy to sort, chart and filter
Follow the route on a GPS device or outdoor appKeep it as GPXIt's already the most widely supported option

If you want the deeper background on how these formats differ (coordinate order, styling, schemas), our GPX vs KML vs TCX vs GeoJSON comparison goes into detail. And if you're not sure what's actually inside your file, start with what a GPX file is.

One honest note up front: our converter does not handle FIT, the binary format most modern Garmin watches and bike computers record in. If a platform only gives you FIT, export GPX from that platform instead, then convert the GPX.

How to use the TrailX GPX converter, step by step

The TrailX Format Converter is free, needs no account and runs entirely in your browser. Nothing is uploaded, which makes it safe for private routes, like one that starts at your front door.

  1. Open the converter. Go to /converters on a laptop or phone. Any modern browser works.
  2. Add your GPX. Click Upload GPS file or drag the .gpx onto the drop zone. The format is detected automatically.
  3. Check the summary. You'll see the route title, the number of trackpoints and waypoints, and the start and end coordinates. If the counts look wrong, stop here (see the errors section below).
  4. Rename it if you like. Click the route title to edit it. The title is written into the new file and also becomes the download's file name, with spaces turned into underscores. "Gössler Alm Hike" downloads as Gössler_Alm_Hike.kml.
  5. Pick a target format. Choose KML, KMZ, GeoJSON, TCX or CSV from the Target File Format menu.
  6. Convert and download. Click Convert to KML & Download (the button label follows your choice). The new file lands in your downloads folder.

It handles one file at a time, so for a batch of routes just repeat.

Always keep the original GPX. Convert a copy for each tool rather than chaining conversions (GPX to KML to GeoJSON), so you never lose detail you can't get back.

What gets kept and what gets lost

Every conversion is a translation, not a copy. Our converter reads your GPX into a simple model: one line of points (latitude, longitude, plus elevation and time if present) and a list of named waypoints. Then it writes that model out in the format you picked. Anything outside the model doesn't make the trip.

Tracks, routes and waypoints

GPX can hold three kinds of geometry, and they're treated differently:

  • Tracks (<trk>) are the main line. If your file contains several tracks or segments, all their points are merged into one continuous line, in file order.
  • Routes (<rte>) are used as the line only when the file has no track. If a file has both, the route is ignored and the track wins.
  • Waypoints (<wpt>) are kept as separate named points, with their descriptions and elevations.

If your GPX has only waypoints and no line at all, the converter joins the waypoints in order to make one, so you still get something drawable.

Format by format

  • KML / KMZ: the line becomes a red path and each waypoint a placemark with its name and description. Elevation is kept. Timestamps are not, because the output is a plain KML path.
  • GeoJSON: elevation is kept as the third coordinate. GeoJSON has no standard field for per-point time, so timestamps are dropped.
  • TCX: written as a course, with waypoints as course points. Timestamps and elevation are kept, with two quirks covered below.
  • CSV: columns are Latitude, Longitude, Elevation, Time, Name, Description and Type, with track points and waypoints labelled in the Type column. Elevation and time are kept wherever the GPX had them.

What never survives: GPX extension data such as heart rate, cadence, temperature or app-specific fields, and any styling.

GPX to KML or KMZ for Google Earth and My Maps

Convert to KML for a readable text file, or KMZ if you're sending it to someone, since it's smaller.

In Google Earth Pro, use File > Open and pick the file. In Google My Maps, create or open a map, add a layer and choose Import. The track appears as a line and your waypoints as pins.

A long route like the Annapurna Circuit Thorong La trek (96.9 km with 4,164 m of ascent) is a nice one to try in Google Earth's 3D view, because the line follows the real elevations from the GPX.

GPX to GeoJSON for web maps, QGIS and developers

GeoJSON is plain JSON, so it drops straight into Leaflet, MapLibre, Mapbox GL or OpenLayers without a parser, and QGIS opens it as a vector layer. It's defined in RFC 7946 if you're building something against it.

The output is a FeatureCollection with one LineString for the track and one Point per waypoint, names and descriptions stored as properties. If you need timing for an animation or a speed chart, convert to CSV instead, or keep working from the GPX.

GPX to TCX for fitness and training platforms

Some training platforms and older Garmin tools still ask for a TCX course rather than GPX. Convert, then import the .tcx wherever the platform asks for a course or route file.

Two things to watch. First, TCX expects a time on every point, so if your GPX has none (a planned route, say), the converter fills in placeholder times five seconds apart. They aren't real, so don't read them as a pace target. Second, TCX limits course names to 15 characters and course point names to 10. A waypoint called "Water refill" becomes "Water refi", so rename long waypoints before converting if the cue text matters to you.

If your platform accepts GPX directly, use GPX. TCX is only worth it when it's the format being asked for.

GPX to CSV for spreadsheets

CSV is the easiest way to poke at a route with numbers. Open it in Excel or Google Sheets and you can chart elevation, filter out waypoints or check the time between fixes, for example on a ride like the Danube Island to Klosterneuburg Ride in Vienna (28.5 km, 215 m of ascent).

If you'd rather let us do the maths, drop the GPX into Upload & analyse instead: it shows distance, total ascent and descent, gradient distribution and, if the file has timestamps, moving time and speeds, all without logging in. Our post on how to read an elevation profile explains what the chart is telling you.

Common errors and how to fix them

"Unable to identify the file format." The file isn't one of the six supported formats. Usually it's a FIT file, or a download that saved a web page instead of the GPX. Open it in a text editor: a real GPX contains a <gpx tag near the top.

Trackpoints matches the waypoint count. Your GPX has no track or route, only waypoints, so the line was built by joining them. Check the original in a viewer (our guide to viewing a GPX online covers a few options) and re-export it with the track included.

Straight lines jumping across the map. Several tracks or days were merged into one line, so the end of one is joined to the start of the next. Split the GPX into separate files first, one per track, and convert each.

The line hides under the terrain or hangs on a "curtain" in Google Earth. The KML path uses the absolute altitudes from your GPX and is extended down to the ground. If your GPX had no elevation, those points are written as 0 m and can sit below the surface in hilly areas. In Google Earth Pro, open the path's Properties, go to the Altitude tab and set it to Clamped to ground, or untick Extend path to ground.

My timestamps disappeared. Expected for KML and GeoJSON. Convert to TCX or CSV if you need time, or keep the GPX.

The route lands in the wrong place. This almost always means coordinates were swapped by hand (KML and GeoJSON use longitude first; GPX labels lat and lon separately). Convert again from the original GPX rather than editing the output.

Skip the converter: export from trail pages and the app

If the route you need is already on TrailX, you don't need to convert anything. Every trail page has an export option that downloads the route as GPX, KML, KMZ, GeoJSON, TCX or CSV directly, including a reversed version if you want to walk or drive it the other way. Exporting needs a free account. Our guide to downloading GPX files walks through it.

The TrailX mobile app does the same on your phone: it imports any of those six formats and can export or share a route in any of them, so a KML a friend sends you can go straight onto your offline map. For the general phone workflow, see GPX on iPhone and Android.

And if you're starting from scratch, plan the line in the Route Composer and export a GPX, then convert that copy to whatever else you need. Our step-by-step route creation post shows the whole process.

Where to next?

Filed underNavigationData
–

Written by

TrailX

Hikers, riders and drivers mapping the world's trails, and sharing what we learn along the way.

Responses