All converters
HomeBlog › How to convert a Shapefile to KML (free, in your browser)

How to convert a Shapefile to KML (free, in your browser)

By Ghulam Hasnain · PhD researcher, Space Science & Technology · · Updated · 4 min read

Shapefiles power desktop GIS, while KML powers Google Earth. So at some point you need to convert a Shapefile to KML. This guide shows the quickest way. It is free, and it runs in your browser, so nothing is uploaded.

Advertisement

The short version

A Shapefile is really several files. They must travel together. So zip them into one .zip. Then drop the .zip into the Shapefile converter. Next, choose KML or KMZ. Finally, download the result. It all happens in your browser.

Convert a Shapefile to KML: zip the .shp, .dbf, .shx and .prj, then convert Shapefile to KML for Google Earth
To convert a Shapefile to KML, zip the parts together first, then export to KML for Google Earth.

Why a shapefile is never one file

The format splits its data across files. The .shp holds geometry. The .dbf holds the attribute table. The .shx is the index. The .prj records the coordinate system. So send only the .shp, and your GIS opens nothing useful. That is why we zip the whole set.

Convert a Shapefile to KML, step by step

  1. Gather the parts. So include at least .shp, .dbf and .shx, plus the .prj.
  2. Zip them into a single .zip archive.
  3. Open the Shapefile converter. Then drop the .zip.
  4. Pick KML or KMZ. Then set a coordinate system if the data is not WGS84.
  5. Finally, click Convert and open the file in Google Earth.

Zip the parts correctly

Select the files themselves, then compress those. So do not zip the enclosing folder. A flat archive always works. Also, confirm every part shares the same base name. For example, roads.shp pairs with roads.dbf, not roads_final.dbf.

Get the coordinate system right

KML is always WGS84 longitude and latitude. So the converter reprojects your data for you. However, it can only do that when the .prj is present. Therefore, always include the .prj.

What happens when the .prj is missing

Without a .prj, nothing knows what the numbers mean. For example, 451234 and 5411234 are metres, not degrees. So treating them as degrees places your data far away. To fix it, set the coordinate system yourself. For instance, use EPSG:27700 for the British National Grid. You can look codes up at epsg.io.

Text and special characters

The .dbf has no reliable encoding label. So accented characters can arrive as question marks. A .cpg file fixes this, because it declares the encoding. KML is UTF-8 throughout. Therefore clean text stays clean.

Make the KML look right in Google Earth

A converted shapefile lands as raw geometry with attributes. It works, but it is rarely pretty. So two small changes help the most.

Choose a sensible label field

Google Earth uses each placemark's name for its label. So pick a short, meaningful column, like a site name. A numeric ID makes a poor label. Also, long labels overlap when features sit close together.

Polygons, lines and height

Polygons convert to filled shapes. Lines convert to paths. Both sit on the ground by default, which suits parcels and roads. However, stray Z values can lift flat data above the terrain. So drop the Z values if you do not need them.

The reverse trip and round trips

Going back is just as easy. So the KML to Shapefile converter turns a Google Earth file into a shapefile. It also pulls popup data into proper columns.

What to expect on a round trip

A shapefile to KML to shapefile trip is not perfectly lossless. Field names get squeezed back to ten characters. Also, mixed geometry must be split, because a shapefile holds one type. So for a lossless format, use GeoPackage instead. In short, to convert a Shapefile to KML cleanly, keep the .prj and pick a good label field.

Frequently asked questions

How do I convert a Shapefile to KML for free?

Zip the .shp, .dbf, .shx and .prj files together, drop the archive into a browser-based shapefile converter, choose KML or KMZ, and download the result. No GIS software or account is needed, and with an in-browser tool the data is never uploaded to a server.

Which shapefile files do I need to include?

At minimum .shp (geometry), .dbf (attributes) and .shx (index). Always add the .prj as well, because it records the coordinate system, without it the converter cannot reproject your data to the WGS84 that KML requires.

Can I convert a Shapefile to KML without ArcGIS or QGIS?

Yes. A browser-based converter runs the same GDAL engine those programs use, compiled to WebAssembly, so no desktop install is needed. It also works offline once the page has loaded.

Why is my converted KML in the wrong location?

Almost always a missing or wrong .prj file. If the shapefile is in a projected system such as UTM or a national grid and no coordinate system is declared, the metre values get treated as degrees and the data lands far from where it should. Include the .prj, or set the coordinate system manually before converting.

What is the difference between exporting KML and KMZ?

KML is plain XML you can open and edit in a text editor. KMZ is that same KML zipped, so it is smaller and can bundle custom icons. Google Earth opens both; use KMZ when emailing large files.

Will my attribute table survive the conversion?

Yes, the .dbf columns become attributes on each placemark and appear in the Google Earth popup. Note that shapefile field names are already capped at 10 characters, so any truncation you see was introduced by the shapefile format itself, not the conversion.

Related converters

Keep reading

About the author

Ghulam Hasnain is a PhD researcher in space science and technology who works with GIS and remote-sensing data every day, wrangling shapefiles, KML, GPX and CAD drawings across QGIS, ArcGIS and Google Earth. He built GISConverter after one too many format conversions that required uploading sensitive survey data to a stranger's server.

Advertisement