beacen.

File formats field answer 101

KML vs GPX: what is the difference, and how do you convert between them?

The short answer

GPX is an XML format for exchanging GPS waypoints, routes and tracks between apps and devices. KML is an XML format for displaying styled, labelled features in an Earth browser such as Google Earth. Convert with a tool that rewrites the structure: Google Earth Pro saves imported GPX as KML, and GPSBabel converts either way. Renaming the extension converts nothing.

The core difference

GPX carries GPS data. KML describes what a map should show.

Both formats are XML text, and both can hold a line across the ground. They were designed for different work. GPX was built so that waypoints, routes and tracks could move between GPS software and online services. KML was built for geographic visualisation: placing labelled, styled features in an Earth browser such as Google Earth and controlling where the viewer looks.

The KML position -3.21,54.45 becomes lat="54.45" lon="-3.21" on a GPX point. If a converted Lake District walk appears in a different country, check this pair in both files before trying a different map.

PurposeExchange or display

GPX moves GPS data between programs. KML tells a viewer what to draw and how it should look.

LineTrack or LineString

GPX stores ordered route points or track points in segments. KML draws a path as a LineString, or a time-stamped track in Google's extension.

CoordinatesDifferent order

GPX gives each point lat and lon attributes in decimal degrees on the WGS 84 datum. KML writes each position as longitude, latitude and optional altitude.

AppearanceStyles live in KML

KML can carry colours, icons, labels, polygons and links to remote data. GPX has no styling layer.

PackagingKMZ is zipped KML

A KMZ archive holds one main KML file plus images or other resources it references.

KML began as Keyhole Markup Language and was submitted by Google to the Open Geospatial Consortium, which adopted KML 2.2 as a standard. GPX 1.1 has been the current version since 2004. The three GPX building blocks are explained in GPX tracks, routes and waypoints.

Pick the file the receiver expects

Route apps and GPS devices usually want GPX. Earth viewers want KML.

  • Navigation apps and devicesUse GPX unless the destination names another format. komoot, for example, imports GPX, TCX or FIT and states that KML is not supported.
  • Google EarthGoogle Earth on the web and mobile primarily imports KML, KMZ, GeoJSON and zipped shapefiles. For GPX, Google's documentation says to convert the file to KML or CSV first.
  • Google My MapsImports both families: KML, KMZ and GPX, with CSV, TSV and spreadsheets. Unzipped KML and KMZ files can be up to 5 MB; other files up to 40 MB.
  • A shared map with notesKML suits a presentation of areas, labelled points and coloured lines. It is a poor choice when the receiver needs an ordered line to follow.

Check the receiver's import list before converting anything. A file that opens in a map viewer may still be refused by a navigation app, and the reverse is also common.

Loss in both directions

Simple geometry converts well. Styling and structure often do not.

A plain line of points survives conversion either way. The rest depends on whether the target format has somewhere to put it.

  • GPX to KMLGoogle Earth asks how to display imported GPS data. KML tracks keep timestamps and can store sensor data such as heart rate. KML LineStrings are lines without time data.
  • KML to GPXGPSBabel's documentation says it reads simple KML fairly well, but camera views, HTML descriptions, layered styles and nested folders have no clear equivalent elsewhere.
  • Polygons and areasGPX holds waypoints, routes and tracks only. A shaded area in KML has no GPX equivalent, so at most its outline can become a line.
  • HeightA KML line set to clamp to the ground ignores its stored altitude. A GPX point's elevation is optional. See whether a GPX includes elevation.
  • Network linksA KML can load another local or remote file. If the line lives in that remote file, the KML you hold may contain almost nothing to convert.

A successful conversion proves the new file opened. It does not prove the line, order and heights came across intact.

A controlled conversion

Use a real converter, then compare the result with the source.

  1. Keep

    Copy the original file first.

    Renaming .kml to .gpx, or the reverse, changes only the label. The contents stay in the old structure.

  2. GPX in

    Convert GPX to KML in Google Earth Pro.

    Drag the GPX into Google Earth and choose tracks or LineStrings. The data appears in Places. Right-click it and choose Save Place As to write a .kml or .kmz file.

  3. KML in

    Convert KML to GPX with GPSBabel.

    It reads and writes waypoints, tracks and routes in both formats. Simple files with points and paths give the most predictable result.

  4. Compare

    Inspect the new file.

    Check that it contains a track or route rather than loose waypoints, and that the start, finish, point count and distance match. How to inspect a GPX file safely covers the checks.

For a browser mapping project, convert track segments into GeoJSON lines without drawing an extra connector.

Sources & scope

What this answer is based on.

The format descriptions come from the GPX 1.1 schema, the OGC KML standard and Google's KML documentation. Converter behaviour follows Google Earth and GPSBabel documentation checked on 24 October 2026 and may change.

More in GPX files

Related questions