geojsonkit.org
GeoJSON utilities, in the browser
Say hi →

KML to GeoJSON

Paste KML or drop a .kml file, get GeoJSON. 100% in-browser — your file never leaves your device. The result is saved to your session so you can jump straight to the viewer or any other tool.

KML to GeoJSON

updated 8 June 2026

Drop a .kml file, or

What this tool does

It takes KML — the XML format Google Earth, Google My Maps, ArcGIS, and most GPS exporters produce — and turns it into a GeoJSON FeatureCollection you can drop into a web map, a database, or any modern GIS tool. Paste the XML into the left pane or drop a .kml file, click Convert, and the GeoJSON appears on the right.

The intent it closes: "someone sent me a KML and my tooling only speaks GeoJSON." Everything runs in your browser, so the file never leaves your device, and the result is saved to your session — jump straight to the Viewer or Validator with it already loaded. Going the other direction? That's GeoJSON to KML.

How this tool works

One click runs a parse-then-rebuild pass, entirely in your browser.

1. Parse the XML

Your text is handed to the browser's own DOMParser as XML. If the markup is malformed — an unclosed tag, a stray ampersand, a broken namespace — parsing fails and the status bar shows Error: … with the position the browser flagged. A clean parse is the only prerequisite; a valid <kml> root with one or more <Placemark> elements inside is the shape it expects.

2. Read each Placemark

When the togeojson library is loaded (it ships with the page), the conversion is delegated to its toGeoJSON.kml() routine, which handles the broad sweep of KML. If that global isn't available, the page falls back to a built-in parser that walks every <Placemark>, takes its <name>, and reads the first <Point>, <LineString>, or <Polygon> it finds. A Point comes from the comma-separated lon,lat[,elevation] in its <coordinates>; a LineString from the space-separated coordinate tokens; a Polygon from its required outer ring plus any inner rings, which become holes.

3. Emit GeoJSON

Each Placemark becomes a Feature — its name lands in properties, its geometry is rebuilt with coordinates in [longitude, latitude] order (the same order KML uses, per RFC 7946) — and all of them are wrapped in a single FeatureCollection, pretty-printed with a 2-space indent. The status bar reports Converted. Features: N so you can sanity-check the count. Download saves it as converted.geojson (application/geo+json), and the output is also written to your session so the Viewer and Validator can pick it up.

Example

Input (KML Placemark):

<Placemark>
  <name>Golden Gate</name>
  <Point>
    <coordinates>-122.478,37.819,0</coordinates>
  </Point>
</Placemark>

Output (one Feature inside the FeatureCollection):

{
  "type": "Feature",
  "properties": { "name": "Golden Gate" },
  "geometry": {
    "type": "Point",
    "coordinates": [-122.478, 37.819, 0]
  }
}

Tips & common pitfalls

  • Styling is not carried over. KML is richer than GeoJSON when it comes to presentation — colors, icons, line widths, and <Style> blocks have no standard home in GeoJSON, so they're dropped. Only geometry and the placemark name make the trip.
  • KMZ files won't work directly. A KMZ is just a zipped folder wrapping a doc.kml. Unzip it on your machine first and feed the .kml from inside.
  • Coordinate order stays as-is. Both KML and GeoJSON use longitude-then-latitude. If your source had the axes flipped, the output will be flipped too — this tool doesn't swap them for you.
  • Check the feature count. The status bar tells you how many features came out. If that number is lower than you expected, a Placemark may be using a geometry type the parser skipped, so eyeball the output before relying on it.

Troubleshooting

I get an "Error: XML parse error" message.

The input isn't well-formed XML. The browser usually points to the position; check for an unclosed tag, a missing <kml> root, a raw & that should be &amp;, or that you didn't accidentally paste a binary KMZ.

The output has fewer features than my KML.

The fallback parser reads the first Point, LineString, or Polygon in each Placemark; very exotic or nested geometries can be skipped. Compare the Converted. Features: N count against your placemark count, and validate the result with the GeoJSON Validator.

My coordinates look backwards (lat/lng vs lng/lat).

Output is always [longitude, latitude], matching KML and RFC 7946. If your original data was already flipped, it stays flipped — the converter copies the order, it doesn't correct it.

FAQ

Does it support KMZ files?

Not directly. KMZ is a zipped archive — unzip it and use the .kml file inside (usually doc.kml).

What happens to my KML folders?

GeoJSON is a flat list of features, so the <Folder> and <Document> hierarchy is flattened away. Each placemark surfaces as its own feature with its name preserved.

Are Z-values (altitude) supported?

Yes for points — if a <coordinates> string carries a third value, it's preserved in the GeoJSON coordinate array.

Is my data sent to a server?

Never. The conversion runs in your browser via JavaScript — your KML never leaves your machine, and the page works offline once loaded.

Can I convert hundreds of files at once?

This UI is built for one file at a time. For bulk jobs, reach for the togeojson CLI or ogr2ogr from the GDAL suite.