Shapefile vs GeoJSON: Which format should you use?
March 2025 · 6 min read
If you have spent more than a week in GIS, you have encountered this situation: someone sends you a dataset and you need to figure out whether to store it as a Shapefile or convert it to GeoJSON first. Both formats can hold the same geometry. Both are supported by every major GIS tool. So which one should you actually use?
The honest answer is: it depends on what you are doing with the data. But that is not very helpful, so let's break it down properly.
A quick history
Shapefile was created by Esri in 1998 and quickly became the standard for exchanging vector data between GIS tools. It predates the modern web by a decade. GeoJSON appeared in 2008 as a lightweight, JSON-based format designed for the web. It became an IETF standard in 2016 (RFC 7946).
They were designed for completely different eras of computing — and that shows in their trade-offs.
File structure
This is the first thing that trips people up. A Shapefile is not one file — it is at least three, all required to be in the same folder:
.shp— the geometry (points, lines, or polygons).dbf— the attribute table (think: a spreadsheet attached to the geometry).shx— an index that links .shp records to .dbf rows
You will often also see .prj (the coordinate reference system) and .cpg (character encoding). If you email just the .shp file to a colleague, they cannot open it. This is why Shapefiles are almost always zipped before sharing.
GeoJSON is a single .geojson file. It stores geometry and attributes together in JSON. You can open it in a text editor, paste it into a Slack message, or drag it onto GitHub — it will render as a map automatically.
The field name problem
Shapefile field names are limited to 10 characters. This is a hard limit inherited from the dBASE III format used for .dbf files. If you have a field called population_2023, it gets silently truncated to population_ or similar when saved as a Shapefile. You might not even notice until you open the data in a different tool and the field names look wrong.
GeoJSON has no such limit. Field names can be as long and descriptive as you like.
Size and performance
For small to medium datasets (under a few thousand features), size is not a meaningful difference. For large datasets, the picture changes.
GeoJSON is verbose — it repeats field names for every single feature. A dataset with 100,000 features and 20 attribute columns will have the column names written out 100,000 times. Shapefile stores column names once in the .dbf header, so the file is noticeably smaller.
For web use, GeoJSON is usually compressed with gzip when served over HTTP, which largely cancels this difference. For bulk processing, Shapefile's binary format is faster to read than parsing JSON.
Compatibility
Both formats are supported by essentially every GIS tool: QGIS, ArcGIS, PostGIS, GDAL, Mapbox, Leaflet, Google Earth, and so on. However, the context matters:
- Desktop GIS (QGIS, ArcGIS) — Shapefile is marginally easier to drag-and-drop because it has been the default for 25 years. Both work fine.
- Web mapping (Leaflet, Mapbox GL JS) — GeoJSON is the native format. You can load a GeoJSON object directly with two lines of code.
- GitHub / data sharing — GeoJSON renders as an interactive map in any GitHub repo. Shapefile does not.
- Python / R scripts — Both are supported via geopandas, fiona, and sf. GeoJSON is often more convenient for quick scripts because it is a single file.
When to use Shapefile
- You are sending data to a client or colleague whose tooling expects Shapefile
- You are working with a legacy enterprise GIS system or government open data portal
- The dataset is very large and you need the binary format's read speed
- You need strict single-geometry-type enforcement (Shapefile enforces this; GeoJSON does not)
When to use GeoJSON
- You are building or consuming a web map
- You need to share data with non-GIS people (it opens in any text editor)
- You are storing data in a GitHub repo and want automatic map previews
- Your field names are longer than 10 characters
- You want a single file you can email, paste, or version-control cleanly
The practical answer
Use GeoJSON as your working format. It is portable, readable, and web-native. When you need to deliver data to someone who specifically needs a Shapefile, convert it — the conversion is lossless for most datasets (as long as your field names are 10 characters or fewer).
If you are building a production GIS database, neither format is ideal — use GeoPackage or PostGIS instead. But for file exchange and web mapping, GeoJSON wins on convenience.
Convert between Shapefile and GeoJSON
Maparz converts between Shapefile and GeoJSON instantly — free, no signup, powered by GDAL.