How to Use KML and GPX Files: Open, View and Convert

Published

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:

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:

  1. Make a copy of the file and rename it from .kmz to .zip.
  2. Extract the ZIP with your computer's built-in tool.
  3. Open the .kml file 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

GPXKML / KMZ
Made forExchanging GPS dataDisplaying data on maps
Typical sourceGPS devices, fitness and hiking appsGoogle Earth, My Maps, GIS, open data
Main contentsWaypoints, routes, tracks with time and elevationPoints, lines, polygons with names and styling
Coordinate orderlat and lon as separate attributeslongitude, latitude, altitude
Compressed formNoneKMZ (ZIP)

How to open KML and GPX files

In your browser with GeoLocatify

  1. Open the GPX viewer.
  2. Choose a GPX, KML or GeoJSON file, or drag it onto the page.
  3. The tracks, routes, areas and waypoints appear on the map, with the start in green and the finish in red.
  4. 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

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:

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

Frequently asked questions

What is the difference between KML and GPX?

GPX is a GPS exchange format built around waypoints, routes and recorded tracks, often with elevation and time for every point. KML is a map display format from Google Earth that stores points, lines and polygons together with names, descriptions and styling. Both are XML text files.

How do I open a KMZ file?

A KMZ file is a zipped KML file. Google Earth and Google My Maps open it directly. For other tools, rename the file from .kmz to .zip, extract it, and open the .kml file inside (usually called doc.kml).

Can I open a GPX file in Google Earth?

Google's documentation for Google Earth says GPX is not directly supported for import and should first be converted to KML, GeoJSON, CSV or Shapefile. Google My Maps, by contrast, imports GPX files directly.

Is it safe to upload my GPX tracks to an online viewer?

It depends on the viewer. Tracks often start and end at your home and include exact times. The GeoLocatify GPX viewer reads the file inside your browser and does not upload it.