BYTETOOLS

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

  1. Paste KML into the input box, or drop a .kml file onto the upload area.
  2. Click Convert to GeoJSON β€” invalid XML is reported with a clear error.
  3. Review the FeatureCollection in the output box.
  4. 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 elementGeoJSON result
PlacemarkFeature
Point / LineString / PolygonMatching geometry type
innerBoundaryIsAdditional polygon ring (hole)
MultiGeometryGeometryCollection
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

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.