GIS · File

GeoJSON ↔ KML Converter

Convert between GeoJSON and KML instantly in your browser. Supports all geometry types, feature properties, file upload, and drag-and-drop. No data leaves your device.

Converter
Input

Drag & drop a file onto the text area, or paste your data directly.

Output
· all processing happens in your browser · no data is sent to any server

What This Tool Does

Bidirectional conversion between the two most common open geospatial file formats.

🔄
Both directions
GeoJSON → KML and KML → GeoJSON. Switch direction with one click. The swap button moves the output back to the input for chaining conversions.
📐
All geometry types
Point, LineString, Polygon (with holes), MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Nested inner boundaries (polygon holes) are preserved in both directions.
🏷️
Properties preserved
GeoJSON properties are written as KML ExtendedData elements. KML ExtendedData and SimpleData are mapped back to GeoJSON properties. Names and descriptions carry through in both directions.
📁
File upload & drag-drop
Paste text directly, click Upload to browse for a .geojson, .json, .kml, or .xml file, or drag-and-drop a file onto the input area. Output downloads as the correct file extension.
🔒
100% client-side
All parsing and conversion runs in your browser using the built-in JSON and DOMParser APIs. No data is sent to any server. Works offline once the page is loaded.
📊
Feature stats
After each conversion, a summary shows how many features were converted and which geometry types were found — useful for verifying that complex files converted as expected.

How to Use This Tool

1
Choose direction
Click "GeoJSON → KML" or "KML → GeoJSON" to set the conversion direction. The input and output panels update to show the expected format for each side.
2
Provide input
Paste your GeoJSON or KML text into the left panel, upload a file using the Upload button, or drag and drop a file directly onto the text area. Click "Load sample" to test with example data.
3
Convert
Click the Convert button (in the card header, the arrow between panels, or the action bar at the bottom). The result appears in the right panel with a feature count summary.
4
Copy or download
Click Copy to copy the output to clipboard. Click Download to save the file — it downloads as output.kml or output.geojson automatically with the correct MIME type.
5
Swap and chain
Click the swap icon between panels to move the output back to the input and flip the direction — useful if you need to round-trip convert or check that data survives both directions.
6
Use in your GIS
Load the .geojson file in Leaflet, Mapbox, QGIS, or any web mapping tool. Load the .kml in Google Earth, Google Maps (My Maps), or any KML-compatible GIS application.

Logic Behind the Tool

How each format is parsed and mapped to the other.

GeoJSON parsing
Input is parsed with JSON.parse(). The tool accepts a FeatureCollection, a single Feature, or a bare geometry object. Each feature's geometry drives the KML element type, and properties are written as <ExtendedData> key-value pairs, with name and description hoisted to top-level KML elements.
KML parsing
Input is parsed with the browser's DOMParser in text/xml mode. Each <Placemark> becomes a GeoJSON Feature. Geometry is detected by querying child element names. <ExtendedData> and <SimpleData> elements are mapped to GeoJSON properties. Styles, folders, and network links are intentionally ignored.
Coordinate order
GeoJSON uses [longitude, latitude, altitude?] order — the opposite of the common "lat, lng" convention. KML uses longitude,latitude,altitude (comma-separated, no spaces). The tool correctly maps between both without swapping values. Altitude defaults to 0 in KML output when the GeoJSON coordinate has only two elements.
What's lost in conversion
KML→GeoJSON loses: styles (colors, line widths, icons), folder hierarchy, camera/LookAt views, ground overlays, network links, and timestamps. GeoJSON→KML loses: nested object properties (serialized to strings), array property values. Geometry and flat key-value properties survive both directions intact.

Frequently Asked Questions

GeoJSON is a JSON-based open standard for encoding geographic data. It supports Points, LineStrings, Polygons, and their Multi- variants, wrapped in Feature and FeatureCollection objects. Each feature carries a properties object with arbitrary key-value data. GeoJSON is the dominant format for web mapping APIs — it's used natively by Leaflet, Mapbox, Turf.js, GitHub map rendering, and countless REST APIs.

KML (Keyhole Markup Language) is an XML-based format developed by Keyhole Inc. (acquired by Google in 2004) and is the native format for Google Earth and Google Maps (My Maps). It's an OGC standard since 2008. Use KML when you need to import data into Google Earth, share layered map data with styling (colors, icons), or work with older GIS tools that don't support GeoJSON. For modern web APIs, GeoJSON is usually the better choice.

GeoJSON follows the mathematical convention of [x, y] = [easting, northing] = [longitude, latitude]. This is consistent with how coordinates work in most CRS (coordinate reference systems) where x is the horizontal axis. KML and many consumer applications use the more human-friendly [latitude, longitude] order. This inconsistency is a well-known "gotcha" in GIS — this tool handles the mapping correctly in both directions without any manual reordering.

Yes. In GeoJSON, a Polygon with holes has multiple rings in its coordinates array — the first is the outer boundary, the rest are inner boundaries (holes). In KML, these map to <outerBoundaryIs> and one or more <innerBoundaryIs> elements. The converter correctly maps both directions, preserving any number of holes in polygons.

GeoJSON: Leaflet, Mapbox GL JS, OpenLayers, QGIS, ArcGIS, GitHub (automatic map preview), geojson.io, VS Code with Geo Data Viewer extension. KML: Google Earth, Google Maps (My Maps import), QGIS, ArcGIS, Esri ArcMap, Global Mapper, OziExplorer, most Garmin/GPS device software. Both formats are supported by GDAL/OGR, which is the underlying converter library in most professional GIS tools.

Related Tools

View all →

Related Reading