features · input
Geometry types
features skipped
These Placemarks had no recognised geometry (GroundOverlays, NetworkLinks, or empty Placemarks are not representable in GeoJSON).
Preview GeoJSON
Conversion failed
How the Converter Works
Browser-Side Conversion Pipeline
KML files are plain XML — the browser's native DOMParser reads them directly, no library needed. KMZ files are ZIP archives; JSZip (loaded on demand) extracts the doc.kml entry before parsing begins. No data ever leaves your browser — Step 2 is only activated for KMZ files.
KML Placemark Structure
Every KML Placemark maps cleanly to a GeoJSON Feature. Properties come from name, description, and ExtendedData elements. Geometry comes from the child geometry element, with coordinates read as lon,lat pairs — longitude first, matching the GeoJSON convention.
What Is a KML File?
KML (Keyhole Markup Language) is an OGC-standard XML format originally created by Keyhole Inc. and later acquired by Google for use in Google Earth. It encodes geographic features — points of interest, routes, terrain overlays, and polygons — in a human-readable, tag-based structure. The OGC adopted KML 2.2 as an official standard in 2008 (OGC 07-147r2), and it remains the native format used by Google Earth, Google Maps, and thousands of geospatial applications worldwide.
KMZ is the compressed variant — a standard ZIP archive with a .kmz extension containing a primary doc.kml file plus optional assets such as icons and overlay images. KMZ files are typically 5–10× smaller than their uncompressed KML equivalents, making them the standard choice when sharing files by email or download link.
GeoJSON (RFC 7946) is the web-native successor to KML for most mapping workflows. It is native JSON, parses in a single JSON.parse() call, and is supported natively by every modern web mapping library — Leaflet, Mapbox GL JS, deck.gl, Turf.js, and Google Maps API — without plugins or converters. When migrating from Google Maps or Google Earth to an open-source web map stack, converting KML to GeoJSON is the first and most essential step.
This converter uses the browser's built-in DOMParser to parse KML as XML, and JSZip (loaded on demand) to extract KMZ archives. No WebAssembly, no server, no upload — the entire conversion runs in the browser with zero network requests after the page loads.
What Is a KMZ File?
A KMZ file is simply a renamed ZIP file. Inside, the root document is always named doc.kml. Sub-directories may contain images referenced by GroundOverlay or custom icons defined in Style elements — these assets are ignored during GeoJSON conversion, since GeoJSON has no styling specification. Only the Placemark geometry and attribute data is extracted.
Google Earth and Google Maps both export to KMZ by default. If you saved a route, marked locations, or drew boundaries in Google Earth and want to display them on a Leaflet or Mapbox map, this tool handles the full conversion in one drag-and-drop.
KML vs GeoJSON: When to Use Each Format
| Feature | KML / KMZ | GeoJSON | Shapefile | GeoPackage |
|---|---|---|---|---|
| Format | XML (text) | JSON (text) | Binary | Binary (SQLite) |
| Styling embedded | Yes | No | No | No |
| Multiple layers | Via Folders | No | No | Yes |
| 3D coordinates | Yes (alt) | Optional | No | Yes |
| Web maps native | Plugin needed | Native | Plugin needed | Plugin needed |
| Human-readable | Yes (verbose) | Yes (compact) | No | No |
| Google Earth | Native | Plugin needed | No | No |
| OGC standard | Yes (07-147r2) | Yes (RFC 7946) | No | Yes |
Convert KML to GeoJSON with GDAL, Python, and Node.js
For bulk conversions, CI pipelines, or files over 200 MB, use a command-line tool. The table below shows the most common approaches.
| Tool | Command / Code |
|---|---|
| GDAL (KML) | ogr2ogr -f GeoJSON output.geojson input.kml |
| GDAL (KMZ) | ogr2ogr -f GeoJSON out.geojson /vsizip/input.kmz/doc.kml |
| Python (kml2geojson) | pip install kml2geojson kml2geojson input.kml output.geojson |
| Python (Fiona) | import fiona, json with fiona.open("input.kml") as src: fc = dict(type="FeatureCollection", features=list(src)) print(json.dumps(fc)) |
| Node.js (togeojson) | npm install @mapbox/togeojson @xmldom/xmldom const fs = require('fs'); const tj = require('@mapbox/togeojson'); const DOMParser = require('@xmldom/xmldom').DOMParser; const kml = new DOMParser().parseFromString(fs.readFileSync('in.kml','utf8'),'text/xml'); const geojson = tj.kml(kml); fs.writeFileSync('out.geojson', JSON.stringify(geojson, null, 2)); |
| QGIS | Layer → Export → Save Features As → Format: GeoJSON → OK |
Frequently Asked Questions
What is the difference between KML and KMZ?
KML (Keyhole Markup Language) is an uncompressed XML text file. KMZ is the zipped version — a standard ZIP archive renamed with a .kmz extension. Inside the ZIP, the primary document is always named doc.kml. KMZ files can also bundle associated assets such as custom icon images and ground overlay images into sub-directories, but these assets are not convertible to GeoJSON. This converter handles both formats: KML is parsed directly; KMZ is first unzipped in the browser using JSZip before the KML inside is parsed.
Is my KML file uploaded to your server?
No. When you drop a file, the browser reads it directly from your local disk using the FileReader API. The file contents are kept entirely in browser memory — no network request is made. The JSZip library used to extract KMZ archives is fetched from a public CDN the first time a KMZ file is dropped, but the KMZ data itself never leaves your machine. You can verify this by opening the browser DevTools Network tab while converting a file — you will see no POST request to any server.
Does the converter preserve KML styles and colors in GeoJSON?
No — and this is by design. The GeoJSON specification (RFC 7946) intentionally omits styling. Geometry, coordinates, and feature properties are preserved; Style, StyleMap, IconStyle, and LineStyle elements are discarded. To control the visual appearance of GeoJSON features on a web map, apply styles in your mapping library (for example, Leaflet's L.geoJSON layer options, or Mapbox GL JS style expressions). If you need styling metadata in the output, consider using the Mapbox simplestyle spec which adds reserved property names that some renderers support.
Why do my coordinates look shifted after converting KML to GeoJSON?
This is very unlikely when converting from KML, because KML always uses WGS 84 (EPSG:4326) with longitude-first, latitude-second coordinate order — the same order required by GeoJSON. If features appear in the wrong location, the most common cause is a KML file that was incorrectly authored with latitude before longitude in its <coordinates> elements (a known bug in some older export tools). You can detect this by checking whether the output appears in the ocean near 0°, 0°. If so, the original KML was malformed — no converter can fix coordinate-swapped input data.
Can I convert a KMZ file that contains images or icons?
Yes — the converter extracts only the doc.kml entry from the KMZ archive and ignores all other files (image directories, icon folders, overlay assets). The GroundOverlay and PhotoOverlay elements are skipped since they represent raster data which has no GeoJSON equivalent. Only Placemark elements with recognised geometry are included in the output. Any Placemarks without geometry (such as folders used only as labels) are counted in the skipped-feature warning.
What is the maximum KML or KMZ file size this tool supports?
The tool enforces a 200 MB input limit. Browser memory is the practical ceiling — the file must fit in RAM along with the parsed XML DOM and the GeoJSON output. For most KML files (point collections, route tracks, boundary polygons) this limit is far above typical file sizes. KML files with tens of thousands of Placemarks are usually under 50 MB. For files larger than 200 MB, use ogr2ogr -f GeoJSON out.geojson in.kml from GDAL — it streams the file and is not memory-limited.
How do I open the converted GeoJSON in QGIS or Mapbox?
QGIS: Drag and drop the .geojson file onto the QGIS canvas, or use Layer → Add Layer → Add Vector Layer. QGIS 3.x recognises GeoJSON natively and assigns EPSG:4326 automatically.
Mapbox GL JS: Add a GeoJSON source with map.addSource('my-data', {type:'geojson',data:'./out.geojson'}) then add a layer referencing that source. The Mapbox Uploads API also accepts GeoJSON files directly.
Leaflet: Load the file with fetch('out.geojson'), parse the JSON, and pass the result to L.geoJSON(data).addTo(map).
Related GIS Tools
GPKG to GeoJSON Converter
Convert GeoPackage files to GeoJSON — browser-based, no upload
Shapefile to GeoJSON Converter
Upload .shp, .dbf, and .prj to convert ESRI Shapefile to GeoJSON
EPSG Code Lookup
Search any CRS definition by EPSG code or keyword
Coordinate Converter
Convert between DD, DMS, UTM, and MGRS formats instantly
UTM Zone Finder
Find UTM zone, EPSG code, and Proj4 string from lat/long
MGRS Bulk Converter
Batch convert MGRS grid references to latitude/longitude