GeoJSON vs Shapefile — Which to Use
GeoJSON and Shapefile are the two most common vector interchange formats in GIS. They are interoperable but built on opposite assumptions: GeoJSON is a single text file designed for the web, the Shapefile is a multi-file binary set designed for desktop GIS. Here is how they actually compare.
Quick comparison
Section titled “Quick comparison”| GeoJSON | Shapefile | |
|---|---|---|
| Container | One .geojson/.json file |
Three or more files (.shp + .shx + .dbf, plus optional .prj) |
| Encoding | Text (JSON), human-readable | Binary, needs a parser |
| Coordinate system | WGS84 (EPSG:4326) per spec | Any CRS recorded in .prj |
| Field names | Any length, unicode | 10 characters max, ASCII |
| Data types | String, number, boolean, null | Number, text, date (no time) |
| Size | Large for big datasets (text overhead) | Compact, but per-file limits around 2 GB |
| Web support | Native (Leaflet, Mapbox, D3, fetch APIs) | None — must convert first |
When to use GeoJSON
Section titled “When to use GeoJSON”GeoJSON is the right default when the data goes to a browser, an API or a scripting environment. Anything that speaks JSON speaks GeoJSON. The trade-off is size: coordinates are stored as decimal text, so a million-point dataset can be hundreds of megabytes. Because the spec pins coordinates to WGS84, projected data must be reprojected before it is valid GeoJSON — GeoJSON Reproject does that locally.
When to use Shapefile
Section titled “When to use Shapefile”Shapefile remains the exchange format that every desktop GIS, courier and government portal still accepts. Use it when a person or system on the other end expects it. Live with its quirks: rename long field names to 10 characters, expect dates without times, and keep the sidecar files together — sending only the .shp loses the attributes.
Converting between them
Section titled “Converting between them”Both directions run locally in your browser with no upload:
- Shapefile to GeoJSON — unpacks the sidecar files into a single GeoJSON
- GeoJSON to Shapefile — packs features into a zipped Shapefile set (
.shp/.shx/.dbf/.prj/.cpg), splitting points, lines and polygons into separate layers, typing attribute columns, and truncating field names to the 10-character Shapefile limit
If the source GeoJSON carries a projected CRS, convert it back to WGS84 with GeoJSON Reproject first — the writer recognises WGS84 and Web Mercator and refuses other systems rather than guessing.
Related pointers
Section titled “Related pointers”- Coming from KML or Google Earth: KML to GeoJSON
- Going to Google Earth: GeoJSON to KML
- Full format walkthrough: GIS File Formats Explained
- Edit geometry before converting: GeoJSON Map Editor