# KML to Shapefile converter

> Turn a KML or KMZ from Google Earth or Google My Maps into a zipped shapefile (SHP) for QGIS and ArcGIS. Free, and no account needed.

Open the tool: https://spatibase.com/tools/kml-to-shapefile/

**KML or KMZ in, SHP out.** The Spatibase KML to Shapefile converter turns a Google Earth or Google My Maps file into an ESRI shapefile in your web browser. The details:

- **One .zip.** A `.shp`, `.shx`, `.dbf`, `.prj` and `.cpg` per kind of shape (points, lines, areas), in WGS 84 (EPSG:4326) with UTF-8 text.
- **What survives:** names, plain-text descriptions, folders and ExtendedData fields, as attribute columns with names of up to 10 characters. Styles, icons and altitude are dropped.
- **Nothing is uploaded.** Files up to 50 MB, no account.

## What it does
- Convert KML and KMZ files to an ESRI shapefile (.zip)
- Splits mixed data into point, line and area layers
- Keeps names, descriptions, folders and ExtendedData as attribute fields
- Shortens field names to 10 characters and lists every rename
- Writes UTF-8 text with a .cpg file, so accents and non-Latin scripts survive
- Adds a WGS 84 .prj file, ready for QGIS and ArcGIS
- Runs in the browser: nothing is uploaded

## How to convert KML to a shapefile
1. Save your map as KML or KMZ. Google My Maps: the three-dot menu next to the map title → Export to KML/KMZ. Google Earth Pro: right-click the folder in Places → Save Place As.
2. Drop the file on the box above, or press Choose a file. A KMZ is unzipped for you.
3. Check the map and the notes under it: they list every shortened field name and anything left out.
4. Press Download shapefile (.zip). A map with pins, paths and areas gives three layers in one zip, such as `trip_points`, `trip_lines` and `trip_areas`.
5. Unzip it next to your project. In QGIS, drag the `.shp` files onto the map. In ArcGIS Pro, use Map → Add Data and pick the `.shp` files.

## Formats and limits
- **Opens:** .kml or .kmz, up to 50 MB. Other map files (KML, KMZ, GPX, GeoJSON, shapefile, CSV) convert too.
- **Downloads:** Shapefile, GeoJSON, CSV of the same features.
- **Privacy:** the file is read in your browser and never uploaded.
- Try it with a sample: https://spatibase.com/tools/kml-to-shapefile/?sample=1
- Download the sample file (the one Open a sample opens): https://spatibase.com/tools/samples/barcelona.kml

## What happens to your KML in a shapefile
| What | What happens |
|---|---|
| Points, lines and areas | Kept, in up to three layers: `_points`, `_lines` and `_areas`. One shapefile can only hold one kind of shape. |
| Names | Kept in a `name` column. |
| Descriptions | Kept in a `descriptio` column, as plain text. Bold, links and other HTML formatting are removed. |
| ExtendedData fields | Kept, one column each. KML stores these values as text, so the columns are text columns; change a type later in QGIS or ArcGIS if you need numbers. |
| Folders | Kept in a `folder` column. Nested folders read like `Trips / 2024`. |
| Field names | Cut to 10 plain characters and kept unique, for example `opening_hours` → `opening_ho`. Accents are dropped (`é` → `e`), and spaces and letters such as `ß` become `_`. The notes list each rename. |
| Long text | Cut at 254 bytes, the most a shapefile text field holds (fewer letters for accented or non-Latin text). The notes say how many values were cut. |
| Styles, colours and icons | Dropped. A shapefile stores no styling; set it again in QGIS or ArcGIS. |
| Altitude and times | Dropped. The shapefile keeps longitude and latitude only, and a Google Earth track’s timestamps have no column. |
| Image overlays and network links | Left out, with a count in the notes. |

## Why the zip has several layers and 10-letter field names
**One shape type per shapefile.** A KML folder can mix pins, paths and areas. A shapefile can’t: each `.shp` holds points, lines or areas, never a mix. So a mixed map becomes up to three layers, named after your file.

**Each layer is a set of five files.** They only work together, so keep them in one folder with the same name:

- **.shp** the shapes themselves
- **.shx** an index that lets apps find each shape
- **.dbf** the attribute table (names, descriptions, your fields)
- **.prj** the coordinate system, here WGS 84
- **.cpg** the text encoding, here UTF-8

**Field names stop at 10 characters.** The attribute table is a dBASE file, a 1980s format with 10 characters per column name. `description` becomes `descriptio`, and a clash gets a number, such as `descript_1`. Need longer names or text? Download GeoJSON from this page too: it has neither limit.

## Convert KML to shapefile with ogr2ogr
GDAL’s ogr2ogr, which comes with QGIS, converts on the command line. The plain command stops at the first shape of another kind (“Attempt to write non-point geometry to point shapefile”), so run it once per kind of shape:

```bash
# each KML folder becomes its own shapefile inside points/, lines/ and areas/
ogr2ogr -f "ESRI Shapefile" points/ places.kml -where "OGR_GEOMETRY='POINT'" -lco ENCODING=UTF-8
ogr2ogr -f "ESRI Shapefile" lines/ places.kml -where "OGR_GEOMETRY='LINESTRING'" -lco ENCODING=UTF-8
ogr2ogr -f "ESRI Shapefile" areas/ places.kml -where "OGR_GEOMETRY='POLYGON'" -lco ENCODING=UTF-8
```

**Keep -lco ENCODING=UTF-8.** Without it, GDAL writes the attribute table in ISO-8859-1, and letters outside it (ř, ł, 東) are lost.

**In Python,** geopandas goes through GDAL too: `gpd.read_file("places.kml")` reads the first folder and `.to_file("places.shp")` writes it, with the same one-kind-of-shape rule.

## Frequently asked questions
### Can Google Earth save a KML as a shapefile?
No. Google Earth Pro can open a shapefile (File → Open, file type ESRI Shape), but it only saves KML and KMZ. Google My Maps exports KML and KMZ only too. Convert the export here, or in QGIS or ArcGIS.

### Why did I get three shapefiles instead of one?
Your KML mixes points, lines and areas, and a shapefile holds one kind of shape. The zip has one layer per kind, such as places_points, places_lines and places_areas. Add all of them in QGIS or ArcGIS to see the whole map.

### Why are my column names cut off after converting KML to SHP?
The shapefile’s attribute table (.dbf) allows 10 characters per column name, so description becomes descriptio and opening_hours becomes opening_ho. The notes under the map list every renamed field.

### How do I convert KML to shapefile in QGIS or ArcGIS Pro?
In QGIS, drag the KML onto the map, right-click the layer and choose Export → Save Features As, with the format ESRI Shapefile. Do it once per layer if QGIS split the KML into points, lines and polygons. In ArcGIS Pro, run KML To Layer, then Feature Class To Shapefile on the result.

### What coordinate system will the shapefile use?
WGS 84 (EPSG:4326), as in the KML, written in the .prj file. For a local grid such as UTM, reproject the layer in QGIS or with the Project tool in ArcGIS Pro.

### Is my KML file uploaded anywhere?
No. Your browser reads and converts the file on your computer, and nothing is sent to Spatibase or anyone else. Only the background map tiles come from the internet.

## Next step
Turn the file into a live map your team can edit: **Save to Spatibase (free)** on the page saves it to a free Spatibase project (https://app.spatibase.com/signup), your places on a map you can edit and a live GeoJSON address for your site. Or download the GeoJSON and import it by hand (https://spatibase.com/docs/content/import/).
