# GPX to KML converter

> Turn a GPX track from your GPS watch, bike computer or hiking app into a KML file for Google Earth. See the route on a map first. Free, and no account needed.

Open the tool: https://spatibase.com/tools/gpx-to-kml/

The Spatibase GPX to KML converter turns a GPX file from Garmin Connect, Strava, Komoot or any GPS device into KML, in your web browser. What carries over:

- **Lines and placemarks.** Each track becomes a line (one part per track segment), each route a line, and each waypoint a placemark with its name, description, symbol and elevation.
- **Not carried over:** the time of every track point, and sensor data such as heart rate, cadence and power.
- **Never uploaded.** Your track stays on your computer. GPX files up to 50 MB convert without an account.

## What it does
- Convert GPX to KML for Google Earth and Google My Maps
- Reads tracks, routes and waypoints from any GPS app or device
- Keeps elevation, names, descriptions and waypoint symbols
- Keeps each track segment as a separate part of the line
- Shows the track on a map before you download
- Also downloads GeoJSON and CSV
- Runs in the browser: your track is not uploaded

## How to convert GPX to KML
1. Export the GPX. On strava.com, open the activity, press the three dots and choose Export GPX. In Garmin Connect, open the activity, press the gear icon and choose Export to GPX. Komoot, OsmAnd and most GPS units save GPX too.
2. Drop the .gpx file on the box above, or press Choose a file. No file at hand? Try the sample: five Barcelona waypoints, a walking route, and three areas saved as closed tracks.
3. Check the map. Tracks and routes are lines and waypoints are pins: click one to see its name and description.
4. Press Download KML. Open it in Google Earth Pro with File → Open, import it into a project in Google Earth on the web, or add it as a layer in Google My Maps.

## Formats and limits
- **Opens:** .gpx, up to 50 MB. Other map files (KML, KMZ, GPX, GeoJSON, shapefile, CSV) convert too.
- **Downloads:** KML, GeoJSON, CSV of the same features.
- **Privacy:** the file is read in your browser and never uploaded.
- Try it with a sample: https://spatibase.com/tools/gpx-to-kml/?sample=1
- Download the sample file (the one Open a sample opens): https://spatibase.com/tools/samples/barcelona.gpx

## What the KML keeps from your GPX
| What | What happens |
|---|---|
| Tracks (`trk`) | A line per track. Each track segment (`trkseg`) stays its own part, so a pause in recording doesn’t draw a straight jump across the map. |
| Routes (`rte`) | A line through the route points, in order. |
| Waypoints (`wpt`) | A placemark each, with name and description. |
| Elevation (`ele`) | Kept as the third value of every coordinate. Google Earth still draws the line on the ground unless you change its altitude setting. |
| Symbol, type and comment (`sym`, `type`, `cmt`) | Kept as data fields on the placemark. |
| Start time of a track, time of a waypoint | Kept as a `time` field on the placemark. |
| Time of each track point | Not kept. A KML line has no timestamps, so the track won’t play on Google Earth’s time slider. |
| Heart rate, cadence, power | Dropped. Garmin and Strava store them per point in GPX extensions, and a KML line has no place for them. |

## GPX or KML: which one does your app need?
The two formats were made for different jobs:

- **GPX is a GPS log.** It records where you were and when: track points with latitude, longitude, elevation and a `<time>`, often with heart rate or cadence from a sensor. Watches, bike computers and fitness apps read and write it.
- **KML is for showing places.** Google Earth and Google My Maps use it to draw placemarks, lines and areas with names, descriptions and styles. A KML line is a list of coordinates, nothing more.

Whether you need to convert at all depends on where the file goes:

- **Google Earth on the web:** imports KML and KMZ, not GPX. Convert first.
- **Google Earth Pro:** opens a GPX itself (File → Open, file type GPS). Convert when you want a KML to share or edit.
- **Google My Maps:** imports GPX as well. KML helps when you want the track as a layer next to other KML data.
- **GIS apps and websites:** many take KML or GeoJSON but not GPX, and this page gives you both.

**Keep the GPX.** It stays the complete record with times and sensor data. The KML is a copy for viewing and sharing, and it can’t be turned back into the full activity.

## Convert GPX to KML on the command line
GPSBabel, the free GPS file converter, does it in one line, and with one option it also keeps the timestamps:

```bash
# lines and waypoints only (points=0: no placemark per track point)
gpsbabel -i gpx -f ride.gpx -o kml,points=0 -F ride.kml

# keep each point's time as a gx:Track, for Google Earth's time slider
gpsbabel -i gpx -f ride.gpx -o kml,points=0,track=1 -F ride.kml
```

In JavaScript, `@tmcw/togeojson` reads GPX into GeoJSON (this converter uses it too), and the `tokml` package writes GeoJSON out as KML.

## Frequently asked questions
### Can Google Earth open a GPX file without converting it?
Google Earth Pro on the desktop can: choose File → Open, set the file type to GPS and pick the .gpx. Google Earth in the browser imports KML and KMZ but not GPX, so convert the file first.

### Does the KML keep the timestamps of my track?
Only the start time, as a field. Each track becomes a KML line with elevation but without a time on every point, so it won’t replay on Google Earth’s time slider. To keep them, open the GPX in Google Earth Pro and choose KML Tracks in its import dialog, or use GPSBabel with the track=1 option.

### What happens to heart rate, cadence and power data?
They are left out. Garmin and Strava store them for each track point in GPX extensions, and KML has nowhere to put them. Keep the original GPX if you need that data.

### Do I need to convert GPX to KML for Google My Maps?
Usually not: My Maps imports GPX directly (Add layer → Import). Convert when the app you use next only reads KML, or when you want the same track in Google Earth on the web.

### Is my GPS track uploaded anywhere?
No. The conversion runs in your browser, so the file, and the places it shows you were, stay on your computer. Only the map background is loaded from the internet.

## Next step
Turn the file into a live map your team can edit: **Save to Spatibase (free)** on the page saves it to a free Spatibase project (https://app.spatibase.com/signup), your places on a map you can edit and a live GeoJSON address for your site. Or download the GeoJSON and import it by hand (https://spatibase.com/docs/content/import/).
