How to convert Shapefile to GeoJSON
- Drop the zipped shapefile, with its .dbf and .prj inside.
- The layer is reprojected to WGS84, which web maps expect.
- Choose GeoJSON and convert; attributes become properties on each feature.
What changes when you convert Shapefile to GeoJSON
| What | Shapefile → GeoJSON | |
|---|---|---|
| Geometry | Kept | The layer's geometry type (points, lines or polygons) is carried over exactly, including multi-part shapes. |
| Attributes | Kept | Every column and full field name moves from Shapefile into GeoJSON untouched. |
| Styling & labels | Kept | Neither Shapefile nor GeoJSON stores visual styling, so there is nothing to lose. Geometry and data carry straight over. |
| Coordinate system | Changes | GeoJSON only accepts WGS84 (EPSG:4326), so data stored in another system is reprojected to longitude/latitude on the way out. |
| Elevation (Z) | Kept | 3D Z values carry from Shapefile into GeoJSON wherever the source records them. |
| File structure | Kept | A single, self-contained .geojson file you can move around on its own. |
Why convert Shapefile to GeoJSON?
GeoJSON is text, which is the quiet reason so many teams keep it in Git: you can diff it, review it and version it line by line, while a shapefile is a bundle of binary parts whose changes no version history can show. The same property helps beyond version control, since web APIs pass GeoJSON around with no extra tooling and every mainstream JavaScript map library parses it natively. A typical job exports parcel boundaries or a road network from a shapefile and renders them in a browser map the same afternoon.
Coordinate system handling
A shapefile records its coordinate system in the .prj sidecar, and the converter reads it automatically, so a layer in UTM, State Plane or a national grid is understood without any setup. A zip without a .prj leaves the system unknown, which is the most common reason converted features land in the wrong place.
GeoJSON is fixed to WGS84 longitude and latitude by RFC 7946, so the output is always reprojected to that system. Nothing needs choosing on the way out; the one job is making sure the input system is known.
What to check when converting Shapefile to GeoJSON
The first thing to check is the coordinate system, because a shapefile carries its CRS in the .prj while RFC 7946 GeoJSON allows nothing but WGS84 longitude and latitude. The layer is reprojected on the way out, and a zip without a .prj leaves the source system unknown, so the features may land in the wrong place. Field names are a second trap: the .dbf clipped them to 10 characters long ago, and those shortened keys carry straight into your GeoJSON properties unless you rename them afterward.
Troubleshooting Shapefile to GeoJSON
- The file will not load. A shapefile is a set of parts, not one file. Zip the .shp together with its .dbf, .shx and .prj and drop the zip, because a bare .shp carries shapes with no attributes and no coordinate system.
- Features land in the wrong country, or in the sea. The zip is missing its .prj, or the .prj names a system the data is not really in. Add the correct .prj and convert again; a layer read in the wrong system cannot be repaired after the write.
- The coordinates look reversed. GeoJSON lists longitude before latitude, X before Y, the opposite of how people say coordinates aloud. The order follows the specification, and Leaflet and Mapbox GL expect it.
- Every feature has empty properties. The .dbf was missing from the zip, so there was no attribute table to read. Rebuild the zip with all companion files inside and run the conversion again.
About the formats
A Shapefile is where most desktop GIS layers live, split across companion files that must travel together. GeoJSON is where web maps want that same data, packed into one readable text file. The conversion folds the geometry and the .dbf attribute table into a single JSON structure that Leaflet, Mapbox GL, OpenLayers and any web API can parse without a plugin, which is why it opens most desktop-to-web workflows.
Frequently asked questions
My field names are still cut to 10 characters. Why?
GeoJSON has no length limit, but the conversion keeps what the .dbf stored. A column shortened to popdens_20 stays that way, so rename the properties afterward in a text editor or QGIS.
What happens if my shapefile zip has no .prj inside?
The source system is then unknown, and the features may land in the wrong place once they are reprojected. Keep the .prj in the zip so the converter knows which system the coordinates start in.
Can I add the file to Leaflet without another step?
Yes. GeoJSON is the native vector format of Leaflet, Mapbox GL and OpenLayers, so the download can be passed to L.geoJSON or a geojson source exactly as it is.
Will a layer in a projected system such as UTM come out as latitude and longitude?
Yes, the coordinates are reprojected to WGS84 longitude and latitude as the file is written, because RFC 7946 allows no other system. A layer in UTM or State Plane therefore arrives in degrees, ready for the web map.
Does the conversion keep every field from the attribute table?
Yes, every field in the .dbf becomes a property on the matching feature, and numeric fields stay numeric in the JSON. That matters when a popup or a style expression reads the values.
Related converters
Ready to convert?
Drop a file and download the result in seconds. Nothing is uploaded, nothing is stored.