GIS · GPS

GPX ↔ KML Converter

Convert GPX tracks and waypoints to KML for Google Earth — or import KML Placemarks back to GPX. Elevation preserved, both directions, nothing sent to any server.

Converter
Input

Drag & drop a .gpx or .kml file, or paste your data directly.

Output
· all processing happens in your browser · no data is sent to any server

What This Tool Does

Convert between two of the most common XML-based geographic formats — GPX for GPS devices and KML for Google Earth.

🔄
Both directions
GPX → KML and KML → GPX. Switch direction with one click. Swap moves the output back to input for round-trip testing.
📍
Waypoints & tracks
GPX waypoints (<wpt>) become KML Point Placemarks. GPX tracks and routes become KML LineString Placemarks. KML Points come back as GPX waypoints; KML LineStrings as tracks.
Elevation preserved
GPX <ele> values map to the altitude component of KML coordinates (lon,lat,alt). KML altitude comes back as GPX <ele> elements. Zero-altitude is written when elevation is absent.
🗺
Polygon → track fallback
KML Polygon Placemarks have no GPX equivalent. The outer boundary ring is converted to a closed track segment so the shape is preserved as a navigable path rather than being silently dropped.
📁
Upload & drag-drop
Paste text, click Upload to browse for a .gpx, .kml, or .xml file, or drag a file onto the input area. Output downloads with the correct extension and MIME type.
🔒
100% client-side
Both GPX and KML are XML — parsed with the browser's built-in DOMParser. No data is uploaded. Works offline once the page loads.

How to Use

1
Choose direction
Click "GPX → KML" to convert a GPS track for Google Earth, or "KML → GPX" to convert a Google Earth layer back to a format your GPS device can read.
2
Provide input
Paste XML text, upload a .gpx or .kml file, or drag-and-drop the file onto the text area. Click "Load sample" to try a Paris landmarks example with waypoints, a track, and a route.
3
Convert
Click Convert. The result appears in the right panel. The success message shows how many waypoints, tracks, and routes were processed.
4
Download or copy
Click Download to save as output.kml or output.gpx. Click Copy to put the text on your clipboard and paste it into another tool.
5
Use in Google Earth
Open Google Earth, go to File → Open, and select the .kml file. Your GPX tracks and waypoints appear on the globe with names and elevation data intact.
6
Load on a GPS device
The output .gpx file can be loaded onto any Garmin device, or imported into Strava, Komoot, AllTrails, or any app that accepts GPX files for navigation.

Logic Behind the Tool

How the two XML formats are mapped to each other.

GPX → KML element mapping
Each <wpt> becomes a KML <Placemark> with a <Point>. Each <trkseg> within a <trk> becomes a separate <Placemark> with a <LineString> — a multi-segment track produces one Placemark per segment. Each <rte> becomes a single LineString Placemark. Names and descriptions carry through.
KML → GPX element mapping
KML <Point> Placemarks become <wpt> elements. <LineString> Placemarks become <trk> elements with a single <trkseg>. <Polygon> Placemarks are converted using their outer boundary ring as a closed track. KML styling, ExtendedData, folders, and camera data are discarded.
Coordinate handling
GPX uses lat and lon XML attributes (latitude first). KML uses comma-separated longitude,latitude,altitude in coordinate text nodes (longitude first). The tool correctly swaps the axis order. Elevation from GPX <ele> maps to KML altitude; missing elevation defaults to 0.
What is lost in conversion
GPX → KML loses: track point timestamps (<time>), GPX metadata (author, link, bounds), waypoint symbol (<sym>), and comments. KML → GPX loses: all styling (colors, icons, line widths), ExtendedData properties, folder hierarchy, ground overlays, camera views, and network links.

Frequently Asked Questions

The most common reason is to view a GPS track in Google Earth. Google Earth does not natively open GPX files — it requires KML or KMZ. If you exported a hike, bike ride, or road trip from your GPS device or a fitness app, converting to KML lets you visualize the route in 3D terrain, measure altitude profiles, and share the layer with others via Google My Maps.

KML files are common in Google Earth, Google Maps exports, and government data portals. If you want to navigate a KML route on a Garmin device, Wahoo computer, or any GPS unit — or import it into Strava, Komoot, or AllTrails for navigation — you need GPX. This converter extracts the geometry and produces a GPX file your device or app can load.

Yes. KML has no standard mechanism for per-coordinate timestamps equivalent to GPX's <time> elements inside <trkpt>. KML does support <TimeStamp> and <TimeSpan> on Placemarks, but these apply to the entire Placemark, not individual track points. If timestamps are critical to your workflow, use the GPX ↔ GeoJSON converter instead — GeoJSON preserves them in a coordTimes array.

Yes, via Google My Maps. Go to mymaps.google.com, create a new map, click "Import" on a layer, and upload the .kml file. Your GPX tracks will appear as lines and waypoints as markers. Note that Google My Maps has a 10MB KML file size limit and some styling limitations compared to full Google Earth.

KML folders (<Folder> elements) are transparent to the converter — Placemarks inside folders are processed the same as top-level Placemarks using CSS querySelectorAll('Placemark'), which searches the entire document tree. Folder names are not preserved in the output GPX because GPX has no equivalent folder structure.

Related Tools

View all →

Related Reading