Convert KML to KMZ

Converting KML to KMZ produces a single compressed archive holding one document, typically around a fifth of the original size. It is a rewrite rather than a repack: the KML is read for its placemarks and lines and written out fresh, so geometry and names cross over while styles, descriptions and network links do not.

  • Where it runs In your browser. The file is never uploaded.
  • Rebuilt KMZ works differently from a KML, so this is not the gradual degradation a lossy codec applies. What KMZ can express is reproduced faithfully; what it has no equivalent for does not survive at all.
  • File size limit Up to 100 MB per file, free, without an account.
  • Worth knowing Positions, elevation and timestamps are carried across. Sensor streams, styling and embedded imagery are not.

Up to 100 files at once. Mixed formats are fine.

The zipped form exists for two reasons, and only one applies here

KMZ was designed to solve a packaging problem. A KML that uses custom pin graphics, a photo overlay or a georeferenced scan refers to those files by relative path, and the moment the document is emailed on its own the references break and the map arrives blank. Bundling the document and its assets into one archive fixes that, and it is the reason the format exists.

The second reason is plainer: a KML is verbose text and text compresses. If your document has no external assets — a set of pins, a drawn route, an export from a database — then packaging is not what you are buying and size is. That is the case this conversion serves, and it serves it well, but it is worth naming which of the two you are actually after before you convert.

What compression buys on a coordinate-heavy document

Measured on a KML holding a single 7,200-vertex line with elevation on every point, the document was about 258 KB and the archive about 47 KB — a factor of five and a half. Coordinate lists are close to the ideal case for a deflate: every entry shares a prefix with the one before it, the separators repeat forever, and the digits that do vary sit in the low positions.

A document made of many short placemarks compresses less well, because the ratio is dominated by the repeated element markup rather than by the numbers, and a document that is mostly prose in description balloons compresses like prose. None of those distinctions changes the decision much, but the guarantee is narrower than it looks. The writer keeps the uncompressed form when deflating would not help, so the payload never grows — the ZIP structure around it does. A local header, a central-directory entry and the end record cost 112 bytes for a file named doc.kml, and the KML inside is re-written rather than copied byte for byte, so a very small document can come out a little larger than it went in. Above a few kilobytes that is noise.

The document inside the archive is a new one

This is the part to understand before converting. The conversion does not take your KML and zip it. It parses the document into the same internal shape every GPS format on this site passes through — points with a position, an optional elevation, an optional time, grouped into named lines and pins — and writes a fresh KML out of that shape, which it then compresses.

The consequence is that the KML inside the archive is not byte-identical to yours, and in most cases is not even close. It will be shorter, its elements will be in a different order, and everything the internal shape has no room for will be absent. If you unzip the result expecting to find your own file, you will not: you will find a clean minimal document describing the same geometry.

The named casualties of the rewrite

Specifically: `<Style>` and `<StyleMap>` definitions and the `styleUrl` references to them, so line colours, widths and custom icons are gone. `<description>` balloons, including any HTML in them. `<ExtendedData>` and schema-typed custom fields, which is where anything database-derived usually lives. `<Folder>` grouping, since the internal shape has one flat list. `<LookAt>` and `<Camera>`, so the view the author chose is not restored. `<NetworkLink>`, `<GroundOverlay>` and `<ScreenOverlay>` entirely.

What survives is the geometry and the labels: every Point becomes a Placemark with a Point, every LineString and gx:Track becomes a Placemark with a LineString, and each keeps the `<name>` it had. The document name is carried. For a file whose content is where things are and what they are called, that is everything. For a styled presentation map, it is a small fraction, and the next section is the better route.

Zipping it yourself keeps every byte, and takes a minute

If the KML carries styling or descriptions you need, the faithful package is one you make by hand. Rename your document to `doc.kml`, add it to a ZIP archive so that it sits at the root rather than inside a folder, and rename the archive from `.zip` to `.kmz`. Every operating system can do both steps without extra software, and the result is a KMZ whose document is your document, unchanged.

The root position is the detail people get wrong. A KMZ whose KML sits one directory down opens in some readers and fails silently in others, and the failure looks like an empty map rather than an error. If you built the archive by right-clicking a folder, that is what happened — select the file itself, not the folder around it.

Network links produce an archive with nothing in it

A `<NetworkLink>` is a KML that contains no data at all: it holds a URL and instructions for refreshing it, and everything you see when you open it was fetched from a server after the file loaded. Live traffic layers, subscription datasets and shared team maps are all built this way, and the file on disk is often only a few kilobytes.

Fed to this conversion, such a file yields no placemarks and no lines, and the result is the message that no track or waypoints were found. That is the correct outcome rather than a parsing failure, and it tells you something useful: the map you were looking at was never in the file, so there is nothing local to compress and no offline copy to make. Downloading the linked resource is the only way to get the data itself.

The icons your document references are not collected

Google Earth, saving a KMZ, walks the document for every referenced asset and copies each one into the archive, rewriting the paths as it goes. That gathering step is the substance of what a KMZ authoring tool does, and this conversion does not attempt it.

The output holds one document and no assets, so a KML referencing local icon files produces an archive that is smaller than expected and incomplete as a package. Since the styling that referenced them was dropped during the rewrite anyway, the two limitations cancel into one consistent result rather than a half-broken file: what you get is plain geometry, drawn with the reader's default appearance, and nothing dangling.

When the archive is the wrong tool for the size problem

Compression is not the only way to make a large KML manageable, and sometimes it is the wrong one. A 40 MB document that is slow in Google Earth is slow because of the number of features it draws, and zipping it to 7 MB changes the transfer time and nothing about the rendering — it decompresses to the same 40 MB before anything appears.

If the problem is performance rather than transfer, the fixes are structural: split the file by region or by layer so each one loads alone, thin dense lines that carry a vertex every metre, or move the data into a format built for volume. If the problem is genuinely that an email will not carry the attachment or an upload form has a ceiling, the archive is exactly right and this conversion is the fastest way to it.

The round trip does not give your document back

Converting the archive back to KML afterwards returns the minimal document, not the file you started with. The rewrite happened on the way in, and nothing downstream can restore a style block, a description balloon or a custom field that was discarded before the zip was written. The two conversions compose into one lossy step rather than cancelling each other out.

That is the practical reason to keep the original rather than treating the archive as its replacement. Storage is not the constraint — the source document is the larger of the two by a factor of five and still measured in hundreds of kilobytes — and it is the only copy holding the styling, the folder structure and the database fields. Treat the KMZ the way you would treat a PDF exported from a document: the thing you hand over, not the thing you maintain.

Compressing a map file without sending it to be compressed

The document is parsed, rewritten and zipped in this browser tab. No request carries it anywhere, which can be confirmed in the network panel during a conversion, and the page continues to work with the connection off.

That is worth more than usual for this particular pair, because the obvious alternative is a file-compression website. A KML of sites, customers, assets or property is business data with locations attached, and the usual route to making it smaller involves handing it to a stranger's server, waiting, and downloading it back. Doing the zip locally removes that hop rather than asking you to be comfortable with it.

How to convert KML to KMZ

  1. Drop your KML file onto this page, or click to choose one.
  2. The placemarks are rewritten and zipped into an archive in your browser.
  3. Download the KMZ, which holds one document named doc.kml.

KML as a document, KMZ as the archive around it

KML compared with KMZ
KMLKMZ
Full nameKeyhole Markup LanguageZipped KML
File extension.kml.kmz
Media typeapplication/vnd.google-earth.kml+xmlapplication/vnd.google-earth.kmz
Published byKeyholeKeyhole
SpecificationOGC KML 2.3OGC KML 2.3
LicensingOpen standardOpen standard
Standing todayCurrentCurrent
Opens in a browserNo browserNo browser
Considered insteadGPXGPX

Opening the result

Google Earth and QGIS read both KML and KMZ, so there is a way to check the result against the original without a second tool.

What each format is for

KML is Keyhole's format. The specification is OGC KML 2.3, and it is worth reading if the file has to outlive the tool that wrote it.

KMZ comes from Keyhole, specified as OGC KML 2.3. Google Earth and QGIS all read it.

KML to KMZ: size, contents and what is dropped

Are my KML files uploaded anywhere?

No. This conversion runs entirely inside your browser, so the file never leaves your device. You can confirm it yourself: open the network tab of your browser's developer tools and convert something. You will see the page load, plus the analytics and advertising the site is paid for with — and nothing carrying your file.

How much smaller does a KML get?

Roughly five and a half times on coordinate-heavy files. A 258 KB KML measured here compressed to about 47 KB, because long runs of similar decimal numbers are close to the best case for a deflate.

Is my KML copied into the archive unchanged?

No, and this is the important caveat. The document is read into geometry and names and written out fresh, so the KML inside the archive is a new file rather than your original compressed.

What does that lose?

Styles, icon references, description balloons, ExtendedData, folder structure, LookAt camera positions and network links. Placemark names, points and lines survive.

How do I make a KMZ that keeps everything?

Zip the KML yourself with the document named `doc.kml` at the root of the archive, then rename the result to `.kmz`. That is a byte-faithful package and takes about a minute.

Does it gather the images my KML points at?

No. Collecting referenced icons and overlays into the archive is what Google Earth does when it saves a KMZ; this conversion writes one document and nothing else.

What is inside the KMZ afterwards?

A single member called `doc.kml`, at the root of the archive. That is the name and the position every KML reader looks for first.

More about these formats