Visualization XML.kmlMIME: application/vnd.google-earth.kml+xml

KML

Google Earth's XML format for placemarks, paths, and styled overlays.

Specification
OGC KML 2.3
Released
2004 (Keyhole, acquired by Google 2004); OGC standard 2008
When to use
Use KML when you need to share something that opens directly in Google Earth, Google My Maps, or a consumer mapping app — typically pre-styled placemarks, routes, or polygons for non-technical viewers. KML carries colour, icons, balloons, and time animation that GeoJSON does not. For GIS analysis or web maps, convert to GeoJSON first.

What is KML?

KML (Keyhole Markup Language) is an XML-based format originally developed by Keyhole, Inc., acquired by Google in 2004, and adopted as an OGC standard in 2008. It is designed for visualisation rather than analysis: a KML document is a tree of Folders containing Placemarks, each of which has a geometry (Point, LineString, Polygon, MultiGeometry, gx:Track) and optional styling (IconStyle, LineStyle, PolyStyle, BalloonStyle), descriptions in HTML CDATA blocks, and time stamps for animation. Coordinates are written as lon,lat,alt triplets — note the comma separator, in contrast to GeoJSON's array notation — and the CRS is fixed to WGS 84. Extensions in the gx: namespace add tracks (timestamped point sequences), tours (camera animations), and multi-tracks for GPS data. KMZ is simply a KML packaged in a ZIP archive together with image overlays and icon resources. Because the format is XML, files are larger than equivalent GeoJSON and require a real XML parser; because it carries styling and HTML, it round-trips poorly with formats that don't.

Supported by

  • Google Earth (desktop, web, mobile)
  • Google My Maps
  • QGIS (native via GDAL LIBKML driver)
  • ArcGIS (To KML toolbox)
  • GDAL/OGR (drivers: KML, LIBKML)
  • FME, Global Mapper
  • Garmin BaseCamp (partial)
  • OpenLayers, Leaflet (via plugins)

Strengths

  • Renders directly in Google Earth with full styling
  • Carries colour, icons, descriptions, and time animation inline
  • Self-contained KMZ bundles image overlays and icons in one zip
  • OGC standard, well-documented, stable
  • HTML description balloons let you embed images and links

Weaknesses

  • Verbose XML — much larger than GeoJSON for the same geometry
  • Coordinate order in KML is lon,lat,alt (a frequent source of bugs when authoring by hand)
  • CRS is locked to WGS 84
  • Styling makes round-tripping to analysis formats lossy
  • KMZ confusion: KMZ ≠ KML, you must extract first for many tools
  • Schema is permissive — different writers produce subtly incompatible files

Converters for KML

Validator

KML Validator

Validate a KML file for XML integrity, Placemark geometry, and coordinate correctness.

Frequently Asked Questions

What is the difference between KML and KMZ?

KML is a single XML document. KMZ is a ZIP archive containing a doc.kml plus any image overlays, icons, or model files it references. Google Earth opens both interchangeably, but many other tools (including most validators) expect plain KML and require you to unzip a KMZ first.

Should I use KML or GeoJSON for web maps?

Use GeoJSON. Modern web mapping libraries (Leaflet, Mapbox GL, MapLibre, OpenLayers) all consume GeoJSON natively, and the file size is a fraction of equivalent KML. KML's advantage — embedded styling — is something you'd normally re-implement in your web map's symbology anyway. Convert KML to GeoJSON and apply styles in code.

Why does my KML show coordinates in the wrong place?

KML coordinates are lon,lat,alt — the opposite of the lat,lon order most humans say out loud. Swapped coordinates produce points in the wrong hemisphere (often in the ocean off the coast of Africa, the famous '(0,0) island' bug).

Are KML styles preserved when I convert to GeoJSON?

No. GeoJSON has no styling concept. GDAL's KML→GeoJSON conversion drops <Style> elements; you'll keep geometry and properties but lose colours, icons, and balloon HTML. Some converters write the style ID into a property so you can re-apply symbology later.

Does KML support time animation?

Yes. KML 2.2+ defines <TimeStamp> and <TimeSpan> elements that let Google Earth animate placemarks along a timeline. The gx:Track extension stores arrays of timestamps paired with coordinates, used for GPS playback.

Related Formats