How to Open a KML or KMZ File
A KML file is a map file written as text: places, paths and areas with their names and descriptions. This guide explains what KML and KMZ files are, how they differ, and how to open one in Google Earth, in Google My Maps, on a phone, and in your browser without uploading it.
Updated
Open a KML or KMZ fileWhat a KML file is
KML stands for Keyhole Markup Language. Google's KML tutorial describes it as a file format for displaying geographic data in an Earth browser such as Google Earth, written in XML: plain text with nested tags. It is an open standard, the OGC KML Encoding Standard, maintained by the Open Geospatial Consortium.
A KML file can hold placemarks (a point with a name and an icon), paths, polygons, ground overlays (an image laid over the map) and descriptions written in HTML, each with a style. Folders group them, and each item can be shown or hidden. Every position is written as longitude, latitude and an optional altitude in meters, in that order. A network link loads more KML from another file or a web address.
Colors are written as eight hexadecimal digits in the order alpha, blue, green, red (aabbggrr), so Google's example 7fff0000 is blue at 50 percent opacity.
What a KMZ file is
A KMZ file is a KML file and the files it uses (images, icons, sounds, 3D models), packed into one ZIP archive so they can be stored and emailed as one file. Google's documentation names the main file doc.kml by default and says the archive should hold only one .kml file. Zipping also compresses it: Google's example is a 10 KB KML file served as a 1 KB KMZ.
KML vs KMZ
The two hold the same map data. The difference is packaging:
| KML | KMZ | |
|---|---|---|
| What it is | A text file in XML | A ZIP archive with one main KML file inside |
| Images and icons | Named by a file path or a web address | Can be packed inside the archive, beside the KML |
| Size | Larger | About a tenth of the KML in Google's example |
| Read in a text editor | Yes | Only after unzipping |
| Google's advice | Fine for a small file that uses no other files | For a KML file larger than 10 KB, or one that uses images, sounds or 3D models |
Google Earth, Google My Maps and the viewer on this site open both. To turn one into the other, use KMZ to KML, which works both ways.
Open it in Google Earth on the web
Google Earth in a browser can open a file on its own, as a local KML file, or add it to a project. A local KML file stays on your computer and is not added to a project, and it works even when you are not signed in. Google's steps:
- On your computer, open Google Earth.
- At the bottom left of the home screen, click Open local KML editor.
- Click Open KML from device and select the file.
To add the file to a project saved in your Google account instead, sign in, click New, then Import file, choose Upload from device or Import from Drive, select the file, and in the How do you want to add this data? dialog choose Map features and click Import. Google's limit for map features is 10,000 features and 250,000 vertices per import. A larger file is imported as a read-only data layer, which is uploaded to Google and counts toward your Google Earth storage.
Google says to save or download changes to a local KML file back to your computer to keep them; Google Earth saves them automatically only in Chromium-based browsers on a computer.
Open it in Google Earth Pro on a computer
- Open Google Earth Pro.
- Click File > Open.
- Select the type of file, or choose All data import formats, and open the file.
The file appears under Temporary Places in the Places panel. To keep it there, Google's help says to drag it out of that folder and choose File > Save > Save My Places before you exit Google Earth Pro.
Import it into Google My Maps to see it in Google Maps
Google Maps shows a KML file through My Maps, which you use in a browser on a computer. Google's steps:
- On your computer, sign in to My Maps.
- Open or create a map.
- In the map legend, click Add layer and give the new layer a name.
- Under the new layer, click Import.
- Upload the KML or KMZ file, then click Select.
Google's limit is 5 MB for a KML or KMZ file, unzipped. Google also says a KML file may not import all of its data, and lists info balloons with HTML or JavaScript, tours, time-based elements, image and screen overlays, MultiGeometries, 3D models and folders. For a larger file, or one with folders, open it in Google Earth, which keeps a KML file's folders when it imports the file into a new project, or in the viewer on this site.
To see the map on your phone, sign in and open the Google Maps app, tap You, then Maps, then the map. My Maps itself is not available for iPhone, iPad or Android, so the import has to be done on a computer.
Open it on an iPhone, iPad or Android phone
The Google Earth app for iPhone, iPad and Android opens a simple KML or KMZ file from your device as a local KML file. Google's steps:
- Open the Google Earth app.
- Select the Local tab on the home screen.
- At the bottom right, tap New, then Local KML editor.
- Select Open KML/Z from device and choose the file.
The file then stays in the local KML files tab on the home screen. To add it to a project instead, open the project, tap More, then Import file to project, and choose Upload from device or Import from Drive.
Open it in your browser without uploading it
The KML viewer on this site opens the file in your browser with no app and no account, and the file never leaves your device.
- Open the viewer and drop the KML or KMZ file on the map, or press Choose a file.
- Use the panel to show or hide folders, search the placemarks, and open one to read its description and data fields.
- Press Export to save the file as KML, KMZ, GPX, CSV, GeoJSON or a Shapefile ZIP.
The viewer draws the file's colors, the icons packed in a KMZ and its image overlays. It does not follow network links or show 3D models and tours, and it says when a file has them. How the viewer works lists everything it draws and what it leaves out.
Read it as text
KML is plain text, so a text editor opens it and shows the tags and coordinates. A KMZ is a ZIP archive: Google's documentation says to change its extension from .kmz to .zip and unzip it, and the main KML file is inside.