.kml

What is a .kml file?

Keyhole Markup Language · Data · Keyhole, Inc. / Google (OGC standard) · 2004

KML is an XML format for geographic visualisation, made famous by Google Earth. It describes placemarks, paths, polygons and overlays, along with how they should look on the map.

Category
Data
Type
Plain text
Is a .kml file safe to open? Safe. KML is map data in XML. It can reference external images and network links, so only open KML from sources you trust.

What is a .kml file used for?

Unlike raw coordinate formats, KML also carries styling: icon, colour, line width and camera angles, so a KML file can define not just where features are but how they appear. A zipped KML with its images is a KMZ file.

It is an Open Geospatial Consortium standard and is read by Google Earth, Google Maps and most GIS software. Because it is XML, it opens in any text editor for inspection.

What opens a .kml file?

The .kml format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.

Windows

  • Google Earth
  • QGIS
  • VS Code

macOS

  • Google Earth
  • QGIS
  • VS Code

Linux

  • Google Earth
  • QGIS
  • VS Code

Web

  • Google My Maps
  • Google Earth web

Open a .kml file step by step

  1. Confirm the file really is a .kml. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with Google Earth or QGIS.
  3. On Mac, use Google Earth or QGIS.
  4. On Linux, try Google Earth or QGIS.
  5. Still stuck? Convert the .kml to GeoJSON, which opens more widely.

Why can't I open my .kml file?

Almost always because no installed app understands KML. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .kml at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .kml file

You can convert a .kml file to GeoJSON, GPX, KMZ using a conversion tool or the export menu of an app that opens it.

What is the .kml file signature (magic bytes)?

A .kml file starts with the hex bytes 3C 3F 78 6D 6C, which read as <?xml in ASCII. Programs identify KML by those bytes, not by the filename, so a renamed file still gives itself away.

These are the documented signatures for KML. For a full breakdown, see the XML file signature page.

Documented magic-byte signatures for the .kml format
Hex signatureOffsetASCIINote
3C 3F 78 6D 6C0<?xml'<?xml' (KML is XML)

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .kml file?

KML is an XML format for geographic visualisation, made famous by Google Earth. It describes placemarks, paths, polygons and overlays, along with how they should look on the map.

How do I open a KML file?

Open it in Google Earth, import it into Google My Maps, or load it in QGIS. A text editor shows the underlying XML.

What is the difference between KML and KMZ?

KMZ is simply a zipped KML, often bundling the icons and images the KML references. Rename a KMZ to .zip to see what is inside.

Is KML the same as GeoJSON?

Both describe map features, but KML is XML with rich styling tied to Google Earth, while GeoJSON is leaner JSON favoured by web maps and APIs.

Comparisons

Related formats

Sources

Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.