KML to KMZ converter

Pack a KML file into a KMZ: the same placemarks in a smaller file that Google Earth and Google My Maps open directly. Free, and no account needed.

Drop a KML or KMZ file here

Download the sample

Your file stays on your computer: nothing is uploaded.

In short

Convert KML to KMZ online, in your browser

The Spatibase KML to KMZ converter zips a KML file into a KMZ in your web browser. What you get:

  • The same KML, smaller. It goes into the archive unchanged, named doc.kml, so placemarks, folders, styles and descriptions are exactly as before, and the KMZ is usually a fraction of the size.
  • Local images left out. Images the KML links by a path on your computer are not added, and the converter tells you when there are any.
  • Nothing is uploaded. KML files up to 50 MB, no account.
How to

How to convert KML to KMZ

  1. Drop the .kml file on the box above, or press Choose a file. Try the sample to see the Barcelona KML zipped.
  2. Check the map, and read the note under it if the KML links to icons or photos on your computer.
  3. Press Download KMZ. The file has the same name with .kmz at the end.
  4. Open it in Google Earth (File → Open in Google Earth Pro, or import into a project on the web), or add it as a layer in Google My Maps.
What’s kept

What goes into the KMZ

WhatWhat happens
Your KMLUnchanged, as doc.kml at the top of the zip: every placemark, folder, style and description.
File sizeSmaller. KML is repetitive text and compresses well.
Icons and images by web address (http…)Still work: Google Earth loads them from the internet as before.
Icons and images by a path on your computerNot added. The converter says when the KML links any, so you can pack them yourself.
Network linksKept as links. The data they point to stays online.
Formats

Why make a KMZ, and what goes in it

A KMZ helps in two ways:

  • Smaller to send. Each placemark repeats the same tags, so KML zips well: the Barcelona sample goes from 18 KB to about 5 KB. Attachments and uploads get faster, and a KMZ is less likely to hit an email size limit.
  • One file, pictures included. A KMZ can carry the photos and icons the KML uses, so the map looks the same on another computer. Google names the main file doc.kml and keeps the rest in a files/ folder.

And two limits to keep in mind:

  • What this converter packs. Only the KML. If it links images by a relative path such as files/icon.png, zip the KML and the images yourself (see the code below), then rename the .zip to .kmz.
  • Size limits don’t change. Google My Maps checks a KML or KMZ after unzipping it, and the limit is 5 MB, so zipping won’t get a big layer past it. Split the layer or remove detail instead.
Do it in code

Make a KMZ in JavaScript

The converter zips with fflate, a small zip library. The same in your own code, in a browser or Node.js:

import { zipSync, strToU8 } from 'fflate'

// kmlText: the KML as a string
const kmz = zipSync({ 'doc.kml': strToU8(kmlText) })

// in a browser: a file to download
const blob = new Blob([kmz], { type: 'application/vnd.google-earth.kmz' })

With images, on the command line: name the KML doc.kml, keep the images in files/ next to it, then run zip -r places.kmz doc.kml files/.

FAQ

Questions about converting KML to KMZ

Is a KMZ just a zipped KML?

Yes. A KMZ is a zip archive with a KML inside, usually named doc.kml, and sometimes the images and icons it uses. Google Earth and Google My Maps open both kinds of file.

Does converting KML to KMZ change my data?

No. The KML goes into the zip unchanged, so names, descriptions, styles and folders stay exactly as they were. Unzipping the KMZ gives you the same file back.

Why don’t my custom icons show after converting?

The KML points to icons or photos on your computer (a relative path such as files/icon.png), and those files aren’t in the KMZ. Put the KML, renamed doc.kml, in a folder with the images, keeping the same paths, and zip that folder’s contents.

Can I make a KMZ in Google Earth instead?

Yes. In Google Earth Pro, right-click a folder or place under Places, choose Save Place As and pick the Kmz type. Google Earth then also packs the local images the KML uses.

Will a KMZ get past the 5 MB limit of Google My Maps?

No. My Maps measures KML and KMZ files after unzipping them, and the limit is 5 MB either way. Split the data into several layers, or simplify long lines, to fit.

Moving the places into Spatibase? Read how to import your data. Need another pair of formats? The GIS file converter converts between all of them.

Talk to us

Not sure it’s a fit? Let’s find out

Tell us about your use case and what you need, from data model to security and deployment. In 30 minutes we’ll look at it together and tell you honestly if we can help.

Or write to hello@spatibase.com.