Live Online ConverterChannel: kmlgeojson

KML to GeoJSON Converter

Convert an XML-based KML file into a GeoJSON file.

Quickly translate XML-based Google Earth Keyhole Markup Language (KML) documents into standard, web-compatible GeoJSON formats. This tool helps remove nested XML complexities and outputs a clean coordinate hierarchy.

Drag file here to convert, or select file

Supported file extension: .kml • Max 50MB

Channel: Direct Stream ModeGDAL Driver Operational

Specification Rules

  • Migrate custom geographic overlays from Google Maps/Earth into web applications
  • Clean up nested XML tagging and convert to highly readable JSON objects
  • Pass route paths to mapping backends in coordinate structures
  • Visual style elements like custom icon colors and line weights are stripped
  • Nested folders inside KML schemas are flattened into a single list
  • Large tracking records containing many point coordinates are slow to parse

GDAL Direct Equivalent Terminal Command

sh — gdalready
$ogr2ogr -f GeoJSON output.geojson input.kml

When to use this conversion

Convert when you have a KML file (often exported from Google Earth or My Maps) and need to display it in a web map library that does not consume KML natively — Mapbox GL, MapLibre, Leaflet, or your own JSON-based pipeline.

Technical Details

GDAL parses the KML XML, walks Folders and Placemarks recursively, and emits each Placemark as a GeoJSON Feature. Coordinate order is converted from KML's lon,lat,alt comma-separated triplets to GeoJSON's [lon, lat, alt] arrays. The KML name and description fields become Feature properties; <Style> elements (icons, colours, line widths) are dropped because GeoJSON has no styling concept. CRS is fixed to WGS 84.
Output file size

GeoJSON is typically 40–60% the size of the equivalent KML because JSON syntax is more compact than XML and styling overhead is dropped. Files with extensive HTML descriptions can see less reduction.

Common Errors & Fixes

  • KMZ uploaded instead of KML: the converter expects plain XML. Fix: rename .kmz to .zip, extract the inner doc.kml, and upload that.
  • Styles lost: colours, icons, and balloon HTML are dropped. Fix: re-apply styling in your web map's code (Mapbox style spec, Leaflet path options).
  • Nested folder hierarchy flattened: KML's organising Folder structure becomes a flat FeatureCollection. Fix: pre-process the KML to add a "folder" property per Placemark before converting.
  • Coordinates appear in wrong location: someone authored the KML with lat,lon order instead of KML's required lon,lat. Fix: identify and swap the bad coordinates manually.

Alternative Tools

  • togeojson (npm: @tmcw/togeojson) for browser-side KML→GeoJSON conversion
  • QGIS: open the .kml, Export → Save Features As → GeoJSON
  • ogr2ogr CLI: ogr2ogr -f GeoJSON output.geojson input.kml
  • mapshaper.org for in-browser conversion with simplification

Frequently Asked Questions

Are custom visual elements over Google Earth preserved?

No. KML visual stylings, icon mappings, and line colors are stripped. Only the raw geospatial geometries and standard descriptive parameters are saved.

Can I convert large zipped KMZ files directly?

KMZ is a zipped archive containing KML data. Currently, you need to unzip the KMZ locally and upload the inner KML file directly to this tool.

How are KML description HTML bubbles represented?

The plain text characters are extracted from CDATA sections and written into the standard 'Description' property of your output features.

Related Transformations Map