.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.

How to open 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. For a step-by-step walkthrough, see how to open a .kml file.

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

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.

.kml file signature (magic bytes)

Programs recognise a .kml file by the bytes at the start of the file, not by its name. These are the signatures for KML.

Hex signatureOffsetNote
3C 3F 78 6D 6C0'<?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: