KML and GPX are the two most common file formats for sharing places, routes and recorded tracks. A hiking app exports your walk as GPX; a colleague sends you a set of map pins as KML or KMZ. Both are plain text files with latitude and longitude inside, and you can open them for free in several ways, including directly in your browser with our GPX, KML and GeoJSON viewer.
What is a GPX file?
GPX (GPS Exchange Format) is described by its maintainer, TopoGrafix, as a light-weight XML format for exchanging GPS data between applications and web services. The current version, GPX 1.1, dates from 2004. A GPX file can hold three kinds of data:
- Waypoints (
wpt): single named points, such as a parking spot or a summit. - Routes (
rte): an ordered list of turn points leading to a destination, usually planned before a trip. - Tracks (
trk): an ordered list of points describing where you actually went, split into segments. Each point can carry an elevation and a time.
The GPX 1.1 schema defines latitude and longitude as decimal degrees on the WGS84 datum, so GPX coordinates match those on your phone and on web maps. A single track point looks like this:
<trkpt lat="40.712776" lon="-74.005974"><ele>10</ele><time>2026-12-04T09:00:00Z</time></trkpt>
GPX files usually come from GPS watches, bike computers, handheld GPS units, and fitness or hiking apps that let you export an activity or a planned route.
What is a KML file?
KML is an XML language for showing geographic data on maps and globes: points, lines, polygons, labels, descriptions, colours and icons. It was created for Google Earth (the name comes from Keyhole Markup Language), and Google later submitted it to the Open Geospatial Consortium, which adopted KML 2.2 as an official standard.
KML files typically come from Google Earth, Google My Maps, GIS software and many government and open-data portals. A point looks like this:
<Placemark><name>City Hall</name><Point><coordinates>-74.005974,40.712776,0</coordinates></Point></Placemark>
Notice the order: KML writes longitude first, then latitude, then an optional altitude, separated by commas with no spaces inside one point. Google's KML reference states this rule and that coordinates are in decimal degrees. If you copy numbers out of a KML file into a search box that expects latitude first, swap them. See latitude vs longitude for more on axis order.
KMZ: zipped KML
A KMZ file is a KML file packed into a ZIP archive, often together with images or icons. According to Google's KMZ documentation, the archive should contain one main KML file, named doc.kml by default. To get at it:
- Make a copy of the file and rename it from
.kmzto.zip. - Extract the ZIP with your computer's built-in tool.
- Open the
.kmlfile inside.
Our viewer needs this unzipped KML; Google Earth and Google My Maps accept the KMZ as it is.
GPX vs KML at a glance
| GPX | KML / KMZ | |
|---|---|---|
| Made for | Exchanging GPS data | Displaying data on maps |
| Typical source | GPS devices, fitness and hiking apps | Google Earth, My Maps, GIS, open data |
| Main contents | Waypoints, routes, tracks with time and elevation | Points, lines, polygons with names and styling |
| Coordinate order | lat and lon as separate attributes | longitude, latitude, altitude |
| Compressed form | None | KMZ (ZIP) |
How to open KML and GPX files
In your browser with GeoLocatify
- Open the GPX viewer.
- Choose a GPX, KML or GeoJSON file, or drag it onto the page.
- The tracks, routes, areas and waypoints appear on the map, with the start in green and the finish in red.
- Read the total length, the elevation gain and loss, the lowest and highest point and, if the file has times, the duration. Move along the elevation profile to see the height at each point.
The length is measured on the WGS84 ellipsoid, the same way as in the distance calculator. For elevation gain, climbs smaller than 2 m are ignored, because GPS heights jitter by a few metres even when you stand still. That is one reason why different apps report different totals for the same file.
In Google Earth
Google Earth imports KML and KMZ files, as well as GeoJSON, Shapefiles and (experimentally) CSV. Google's import guide says that formats such as GPX are not directly supported and should be converted first. The GeoJSON export of our viewer is one easy way to do that.
In Google My Maps
Google My Maps can import KML, KMZ and GPX directly, along with CSV and spreadsheet files. Its help page lists the limits: unzipped KML and KMZ files up to 5 MB, other files up to 40 MB. My Maps is handy when you want to share a route with others or add notes to it.
On your phone
Many hiking, cycling and navigation apps can import a GPX file to follow a route, and export your recordings as GPX. On a phone you can also open the GPX viewer in the browser and pick the file from your downloads. To see your own position next to a track, use my location.
Converting between formats
- GPX or KML to GeoJSON: open the file in the GPX viewer and press Export GeoJSON. GeoJSON is the format web maps and GIS software such as QGIS read most easily. Like KML, it writes longitude before latitude.
- KMZ to KML: unzip it as described above.
- To GPX or KML: GIS programs and Google Earth can save data as KML; many route planners export GPX.
- A single point: you do not need a file at all. Copy the latitude and longitude and use lat long to address, or convert to other formats with the DMS converter.
Converting between formats does not change the coordinates, but some details can be lost. Styling and descriptions in KML have no place in GPX, and times may not survive every conversion.
Privacy of tracks
A recorded track says more than a route on a map. It usually contains:
- Your start and end point, which is often your home or workplace.
- Exact times for every point, showing when you left and when you are usually away.
- Your routine, if you share many tracks from the same place.
Before sharing a GPX file publicly, trim the first and last few hundred metres, or start and stop recording away from home. Remember that a file you export keeps its times: the GeoJSON export of our viewer, for example, carries the track times over. Be careful with online tools that upload your file to a server. The GeoLocatify GPX viewer reads the file with JavaScript inside your browser, so it never leaves your device.
Common problems
- The file will not open: it may be a KMZ that has not been unzipped, or a file whose content is not GPX, KML or GeoJSON despite its name.
- The track is in the ocean or on the wrong continent: latitude and longitude were probably swapped when the file was made by hand.
- No elevation profile: the file has no elevation values. Look up single points with the elevation finder.
- Different distance than your app: apps smooth tracks and filter noise differently; small differences are normal.