How to Convert KML to GeoJSON for Web Maps
To convert KML to GeoJSON, paste your KML or drop a .kml file into a browser-based converter, click Convert, and download a clean GeoJSON FeatureCollection ready for Leaflet, Mapbox, QGIS, or PostGIS. Every Placemark becomes a Feature, polygon holes and MultiGeometry are handled, and nothing is uploaded to a server.
KML is what Google Earth and My Maps produce, but modern web-mapping stacks and databases expect GeoJSON. Rewriting nested XML into RFC 7946 JSON by hand is slow and easy to get wrong, so a converter is the sensible bridge between the two worlds.
Why convert KML to GeoJSON?
Developers migrate hand-drawn My Maps data into their own apps, and analysts pull KML layers into GeoJSON-first tooling like QGIS or a Leaflet front end. The converter turns Points, LineStrings, and Polygons β including inner rings β plus MultiGeometry into standard GeoJSON, and preserves placemark names and descriptions as feature properties.
How to convert KML to GeoJSON in your browser
- Paste KML into the input box, or drop a .kml file onto the upload area.
- Click Convert to GeoJSON β invalid XML is reported with a clear error.
- Review the FeatureCollection in the output box.
- Download the .geojson file or copy it straight into your code.
How KML structure maps to GeoJSON
KML and GeoJSON organise data differently, so here is what becomes what during the conversion:
| KML element | GeoJSON result |
|---|---|
| Placemark | Feature |
| Point / LineString / Polygon | Matching geometry type |
| innerBoundaryIs | Additional polygon ring (hole) |
| MultiGeometry | GeometryCollection |
| Enclosing Folder | "folder" property on each feature |
Because GeoJSON has no folder concept, the converter preserves the Google Earth organisation by writing the folder name into a property, so you can filter or group by it later in QGIS, Leaflet, or your own code.
Key features and benefits
- Placemark Point, LineString, and Polygon support.
- Polygon inner rings (holes) converted correctly.
- MultiGeometry mapped to a GeoJSON GeometryCollection.
- Folder names preserved as a feature property.
- Pretty-printed, valid GeoJSON output with download.
- 100% client-side β the KML is never uploaded.
Try the KML to GeoJSON Converter now β it's free and runs entirely in your browser.
Frequently asked questions
How do I export KML from Google Earth first?
In Google Earth, right-click your folder or placemark and choose "Save Place Asβ¦" with the .kml extension (not .kmz), then drop that file here and download the .geojson. Each placemark becomes a feature with its name and description as properties.
Can it convert KMZ files?
Not directly β KMZ is a zip archive containing a doc.kml. Unzip it first (rename to .zip if your tools require it), then convert the inner .kml file here. Everything else works the same.
What happens to KML folders?
GeoJSON has no folder concept, so the converter writes each enclosing folder's name into a "folder" property on its features. You can then filter or group by that property to recreate the original structure.
Why are my coordinates in longitude, latitude order?
Because the GeoJSON specification (RFC 7946) requires [longitude, latitude] positions, matching KML's lon,lat,alt order. Libraries like Leaflet flip to lat,lon internally, so never hand-swap the values β pass the GeoJSON as-is.
Does it handle polygons with holes?
Yes. A KML polygon's outerBoundaryIs becomes the first GeoJSON ring and each innerBoundaryIs becomes an additional ring, which is exactly how GeoJSON represents holes, so donut-shaped zones and lakes convert without distortion.
Related free tools
- GeoJSON to KML Converter β convert in the opposite direction.
- GPX to KML Converter β turn GPS tracks into Google Earth files.
- JSON Formatter β tidy and indent your GeoJSON output.
- XML Validator β check your KML is well-formed first.
Built by ByteVancer
ByteTools is a free product of ByteVancer, a software and web development studio that builds web apps, SaaS platforms, and custom software for businesses. If you need mapping data pipelines or custom GIS software, explore ByteVancer's services or reach out about your next project.
Recommended reading
KML to GeoJSON Use Cases: Real Web-Map Workflows
Real scenarios for converting KML to GeoJSON: migrating My Maps into apps, loading layers into QGIS and Leaflet, and feeding PostGIS, with worked examples.
KML to GeoJSON: Best Practices and Common Mistakes
Expert tips for converting KML to GeoJSON cleanly: KMZ handling, lon/lat order, preserving folders, holes and the pitfalls that break web maps.
XOR Cipher Use Cases: CTFs, Learning, and Puzzles
Real use cases for the XOR cipher, from CTF challenges and teaching bitwise logic to lightweight obfuscation, with concrete worked examples.
XOR Cipher Tips: Keys, Security, and Common Mistakes
Pro tips and common mistakes for the repeating-key XOR cipher: key length, reuse pitfalls, format choices, and when to switch to real encryption.