KMZ File Documentation


Summary

A KMZ file is a zipped Keyhole Markup Language file: a map of placemarks, lines, areas, image overlays and sometimes 3D models, packaged for Google Earth and other mapping tools. It is a standard ZIP archive that bundles a main KML document (conventionally doc.kml) with every image and icon it references. Open it by importing it into Google Earth, or rename it to .zip and unzip it to recover the doc.kml. Its MIME type is application/vnd.google-earth.kmz.

Technical details

FeatureValue
Full nameKeyhole Markup Language Zipped
File extension.kmz
MIME typeapplication/vnd.google-earth.kmz
Format typeZIP archive containing a KML document plus referenced assets
Container / base formatZIP (DEFLATE)
DeveloperKeyhole, Inc. (acquired by Google, 2004); KML now an OGC standard
Introduced2004 (Google Earth); KML 2.2 adopted by OGC in 2008
Open standardYes — OGC KML 2.2/2.3
Byte orderZIP structures little-endian; KML is UTF-8 XML text
Magic number50 4B 03 04 (“PK”, ZIP local file header)
Main entrydoc.kml (first KML in the archive by convention)
Bundled assetsIcons, ground/screen-overlay images, and any COLLADA (.dae) models
Uncompressed sibling.kml (plain XML, no images bundled)
Inspect withAny ZIP tool (rename to .zip)
Related extensions.kml, .gpx, .geojson, .shp, .dae
Specificationogc.org/standard/kml/
File signature (magic bytes)
50 4B 03 04

Offset 0, 4 bytes. In ASCII this reads P K \x03 \x04, the standard ZIP local file header, because a KMZ is a ZIP archive. Rename a .kmz to .zip and any archive tool will open it, revealing doc.kml (the map) plus the icons, overlay images and any COLLADA models it references. An empty archive starts with the central-directory signature 50 4B 05 06 instead. The uncompressed sibling .kml has no binary signature: it is plain UTF-8 XML.

What is a KMZ file?

KMZ is the compressed, packaged form of KML (Keyhole Markup Language), the XML grammar for geographic annotation: placemarks, lines, polygons, image overlays, 3D models, camera viewpoints and time data. KML was created by Keyhole, Inc. for its EarthViewer product; Google acquired Keyhole in 2004, EarthViewer became Google Earth, and in 2008 the Open Geospatial Consortium adopted KML 2.2 as an open international standard. KMZ is not a separate data format. It is a ZIP archive that holds one main KML document plus every resource that KML references, and its MIME type is application/vnd.google-earth.kmz.

The reason the zipped form exists is practical. A single KML can reference many external images — custom placemark icons, ground-overlay photos, textures for a building model — and can itself grow large. KMZ bundles the KML and all of those resources into one tidy, compressed file that is easy to share or download. In everyday use “KML” and “KMZ” are nearly interchangeable: almost every tool that opens one opens the other, and you can always unzip a KMZ to recover its KML. Everything below is about how that archive is laid out and what the KML inside actually says.

The ZIP container: doc.kml and the files folder

Because a KMZ is an ordinary ZIP, it begins with the ZIP local file header 50 4B 03 04 (“PK”), and you can rename it to .zip and open it in any archive tool. Inside, the layout follows a simple convention.

route.kmz  (a ZIP archive)
├─ doc.kml                 the main KML document (XML) — the map itself
└─ files/                  referenced resources
   ├─ icon-pin.png         a custom placemark icon
   ├─ overlay-map.jpg      a ground-overlay image
   └─ model/building.dae   a COLLADA 3D model + its textures

The rule Google Earth follows is: load the first .kml file found in the archive as the root document, regardless of its name, though the convention is to call it doc.kml. Every other file is a resource the KML points to by a relative path. When the KML writes <href>files/icon-pin.png</href>, the reader resolves that path inside the archive rather than on disk. This is why a KMZ is self-contained where a bare KML is not: the KML’s relative links all resolve to siblings zipped in alongside it.

Inside doc.kml: Document, Placemark and geometry

The KML at the heart of a KMZ is UTF-8 XML in the KML namespace. Its root is <kml>, which contains a <Document> holding features. The workhorse feature is <Placemark>, which pairs a name and description with one geometry.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
 <Document>
  <Placemark>
   <name>Trailhead</name>
   <Point>
    <coordinates>-122.0822,37.4222,0</coordinates>
   </Point>
  </Placemark>
 </Document>
</kml>

The geometry types are <Point> (a pin), <LineString> (a path or route), <Polygon> (an area or boundary), and <Model> (a 3D mesh placed on the globe). Coordinates are the single most important detail to get right: KML orders them longitude, latitude, altitude, comma-separated with no spaces inside a tuple. That is the reverse of the “lat, long” order people usually speak, and swapping them drops a placemark into the wrong hemisphere. Altitude is in metres and is interpreted according to an <altitudeMode> such as clampToGround or absolute.

Styles, ground overlays and the resources they pull in

Appearance is separated from geometry through <Style> elements, which are what make a KMZ (rather than a lone KML) worthwhile. An <IconStyle> names a custom marker image with an <Icon><href>, a <LineStyle> sets colour and width for paths, and a <PolyStyle> fills areas. KML colours are written as aabbggrr hex — alpha, then blue, green, red — which is the reverse of the web’s rrggbb and another common source of “my colours look wrong” confusion.

A <GroundOverlay> drapes an image (a scanned map, a heat map) over a geographic box defined by north/south/east/west edges, and a <ScreenOverlay> pins an image such as a logo to a fixed screen position. Each of those <href> values is exactly the reason to package as KMZ: the overlay images they reference get zipped inside the archive so the map travels complete. Extract the KMZ and you will find every image named by an <Icon> or overlay sitting in the archive.

3D-model KMZ: COLLADA geometry on the globe

One important KMZ variant carries a 3D building or object rather than flat map features. A SketchUp model exported for Google Earth ships as a KMZ whose KML contains a <Model> element with a <Location> (the real-world longitude/latitude/altitude to place it), an <Orientation> and <Scale>, and a <Link><href> pointing at a COLLADA .dae file zipped inside. The geometry and its texture images live in the archive next to the KML. This is why converting a KMZ to a plain mesh format is only meaningful for these model KMZs: you unzip the archive, take the .dae, and import that into a 3D tool. A KMZ that holds only pins and lines has no mesh to extract.

KMZ versus KML, and getting the KML out

The difference is exactly compression plus bundling. KML is the plain XML; KMZ is the same data ZIP-compressed with its referenced images packed in. No map data is lost going either direction. To extract the KML, rename the .kmz to .zip and open it with any archive tool, then pull out doc.kml; or in Google Earth Pro, right-click the loaded item and choose Save Place As with the .kml option. Going the other way, saving as KMZ re-gathers any referenced local images into the archive. If a KML references images by absolute web URLs rather than local files, its KMZ may contain only the doc.kml, because there was nothing local to bundle.

Frequently asked questions

How do I see what is inside a KMZ file?

Rename it from .kmz to .zip and open it with any archive tool such as 7-Zip or the built-in Windows/macOS extractor. You will find doc.kml (the map document) plus any image, icon or 3D-model files it references, all preserved with their relative paths.

Why did my placemarks land in the wrong place?

Almost always because the coordinates were entered as latitude, longitude when KML requires longitude, latitude, altitude. KML lists longitude first, comma-separated with no spaces inside a tuple. Swapping the two moves a point to a completely different part of the globe. Check the <coordinates> order in the extracted doc.kml.

References