KML vs KMZ vs GPX: What's the Difference?
KMZ is just a zipped KML file. GPX is a different format built for GPS tracks, routes and waypoints. Here is what each one holds and how to choose.
KMZ is a zipped KML file, and GPX is a separate format built for GPS data. That is the whole difference in one line. KML and KMZ are for showing a map in Google Earth and similar apps. GPX is for moving your recorded tracks, planned routes and saved points between GPS devices, phones and trail apps.
The three formats side by side
| KML | KMZ | GPX | |
|---|---|---|---|
| Purpose | Describe what to show on a map and how to show it | Package a KML file, plus any images it uses, into one file | Exchange GPS data between apps and devices |
| Structure | Plain-text XML | A zip archive with a KML file inside (usually doc.kml) | Plain-text XML |
| What it stores | Placemarks, paths, polygons, overlays, descriptions and styling | The same as KML, plus bundled icons and images | Waypoints, routes and tracks |
| Typical apps | Google Earth, GIS software, web map tools | Google Earth and many KML apps | GPS units, phone hiking apps, fitness and route-planning apps |
| File size | Larger, uncompressed text | Smaller, because it is compressed | Larger, uncompressed text |
| Best for | Presenting a map with styling | Sharing a styled map with its pictures | Navigating with a recorded or planned track |
What KML is
The Open Geospatial Consortium (OGC), which publishes KML as a standard, describes it as an XML language focused on geographic visualization, including annotation of maps and images. In its words, "KML encodes what to show in an earth browser, and how to show it."
The everyday building block is the placemark, a pin on the globe with a name and description. Google's own tutorial lists placemarks, descriptions, ground overlays, paths, and polygons among the things you can draw. So a KML file might hold a boundary outline, a set of labelled points with custom icons, or an old map image draped over the terrain. If you have a KML file and just want to see it, the KML and KMZ viewer opens it in your browser.
What a KMZ file is
A KMZ file is a KML file that has been zipped. Google's documentation says the main KML file and its supporting files are packaged using a Zip utility into one unit, called an archive, and that the .kmz extension is reserved for the name of the archive itself. By default the KML inside is named doc.kml.
The benefit is practical. A KML file that points to custom icons or photos normally needs those images stored alongside it, and they get lost when you email the file. In a KMZ they travel inside the same file. Zip is also a compressed format, so the file is usually smaller too. Nothing about the map data changes, so a KMZ and the KML inside it show the same thing in Google Earth.
Because a KMZ is only a zip, you can usually rename a copy to .zip, open it, and find the KML inside. That is handy when an app accepts KML but not KMZ. The map data will load, but custom icons and photos will be missing unless the app can find them, so keep the original KMZ.
What GPX is
GPX is a different kind of file with a narrower job. Its home page calls it a light-weight XML data format for the interchange of GPS data and says it covers waypoints, routes, and tracks. The three terms mean different things:
- Waypoint: a waypoint, point of interest, or named feature on a map. Think of a trailhead, a spring or a summit you saved.
- Route: an ordered list of waypoints representing a series of turn points leading to a destination. This is a planned path you have not walked yet.
- Track: an ordered list of points describing a path. This is what your watch or phone records as you move.
GPX is an open standard, which is much of why so many devices and apps support it. It is built to carry location data, not map styling, so it does not describe how a map should look. Track points can also carry time and elevation, which is why fitness and hiking apps use GPX for recorded activities. To check a recorded hike, drop it into the GPX viewer.
KML vs GPX: which one do you need?
The question to ask is what the file will be used for.
- Navigating or recording a trip: use GPX. Most dedicated GPS units and trail apps list it as their import format (check your device's manual), and it keeps tracks, routes and waypoints as separate things.
- Looking at a place in Google Earth, or presenting a map with colours, labels and area outlines: use KML.
- Sending a KML map that contains images or custom icons: use KMZ so the pictures stay attached.
- Sharing a plain set of points or a simple line with someone who might open it anywhere: KML is the safer pick for desktop globes and GIS tools, GPX for devices and trail apps. If you are unsure, ask what they will open it in.
If a device won't load a KMZ, this is usually why: many apps open both formats, but GPS units and watches are more likely to accept only GPX. Check what the receiving device or app accepts before you send anything.
To look at a file in Google Earth, KML and KMZ are the safe choice. Google's import page says Google Earth for web and mobile primarily supports KML, KMZ, GeoJSON and Shapefile for direct import, and suggests converting formats such as GPX to KML first. To simply look at a file without converting, the viewers on this site open each type directly.
Converting between them
KML and GPX are both plain-text XML (a KMZ is a zipped KML), so conversion is routine, but it is not lossless in every direction:
- KML to KMZ and back loses nothing. It is only zipping and unzipping.
- GPX to KML normally keeps the lines and waypoints, but time stamps and extra sensor data (heart rate, cadence) may not survive, and some converters merge tracks, routes and waypoints. Check the converter's output.
- KML to GPX has to decide whether a line becomes a track or a route, so check which one you got. It keeps only what GPX can hold: points and lines. Polygons, overlays and styling have no home in GPX and will be dropped or flattened by most converters, so check the result on a map before you rely on it.
This site does not have a converter for these yet, so you will need a converter or GIS tool. To check the result, open it in the KML viewer or GPX viewer and compare the line with the original.