← Back to Blog

How to Convert Shapefile to GeoJSON Online (Free)

Convert ESRI Shapefiles (.shp, .dbf, .zip) to GeoJSON online for free. Step-by-step guide covering browser tools, ogr2ogr, and Python. No software install required.

Shapefiles are the most widely distributed vector GIS format in the world — government portals, open-data platforms, and legacy GIS workflows export them by default. But when you need to display geographic data in a web application, feed a geospatial API, or use a JavaScript mapping library like Leaflet or Mapbox GL JS, you almost certainly need GeoJSON instead. Converting a Shapefile to GeoJSON used to require desktop software like QGIS or ArcGIS. Today you can do it entirely in your browser in under a minute, with zero upload to any server. This guide covers three conversion methods: a free browser tool, the industry-standard ogr2ogr command, and a Python one-liner.

Why Convert Shapefile to GeoJSON?

The ESRI Shapefile format was introduced in the early 1990s and remains ubiquitous, but it was designed for desktop GIS software, not the web. GeoJSON, defined in RFC 7946, is the native format of the modern geospatial web. Converting your shapefile to GeoJSON makes sense when you need to:

  • Use a web mapping library — Leaflet, Mapbox GL JS, OpenLayers, and Deck.gl all accept GeoJSON natively. Shapefiles require a server-side parsing step or a client-side binary decoder before they can be rendered.
  • Call a geospatial API — Most REST APIs and platforms (Mapbox, AWS Location Service, Google Maps API) accept GeoJSON as their geometry input format.
  • Share data as a single file — A Shapefile is actually 3–6 separate files (.shp, .dbf, .shx, and optionally .prj, .cpg, .qpj). A GeoJSON is a single, self-contained text file that anyone can open and inspect.
  • Remove the 2 GB file size limit — Individual Shapefile component files cannot exceed 2 GB. GeoJSON has no such restriction.
  • Preserve long attribute names — The .dbf format inside a Shapefile limits field names to 10 characters. GeoJSON properties can have any length name.

Convert Shapefile to GeoJSON Using GeoDataTools

The fastest way to convert a Shapefile to GeoJSON without installing any software is the GeoDataTools Shapefile-to-GeoJSON converter. All processing runs in your browser using JavaScript — your files are never uploaded to a server, so sensitive or proprietary data stays private.

  1. Go to the Shapefile to GeoJSON converter.
  2. Drag and drop either a ZIP archive containing your .shp and .dbf files, or upload the .shp and .dbf files individually. The .shx index file is optional — the converter works without it.
  3. The tool reads the binary .shp geometry stream and the DBF attribute table in parallel, then assembles a GeoJSON FeatureCollection.
  4. Review the feature count, geometry type distribution, and a sample of parsed properties shown in the preview panel.
  5. Click Download GeoJSON. The resulting file is a standards-compliant GeoJSON FeatureCollection ready for any mapping library or API.

This method supports shapefiles up to 30 MB and handles all standard geometry types: Point, MultiPoint, PolyLine (mapped to LineString / MultiLineString), Polygon, and MultiPatch. After downloading, you can drag the GeoJSON directly into the GeoDataTools map viewer to visualize it, filter features, and inspect the attribute table.

Convert Shapefile to GeoJSON with ogr2ogr

ogr2ogr is part of the GDAL/OGR library suite — the industry-standard open-source geospatial data processing toolkit. It converts between more than 80 vector and raster formats and handles coordinate reprojection transparently. To convert a Shapefile to GeoJSON from the terminal:

ogr2ogr -f GeoJSON output.geojson input.shp

By default, ogr2ogr reprojects the coordinates to WGS 84 (EPSG:4326) — the coordinate reference system required by the GeoJSON specification — reading the source projection from the .prj file if present. A few useful variants:

# Explicitly specify source CRS if .prj is missing
ogr2ogr -f GeoJSON output.geojson input.shp -s_srs EPSG:3857

# Export only features matching a filter
ogr2ogr -f GeoJSON filtered.geojson input.shp   -sql "SELECT * FROM input WHERE population > 100000"

# Simplify geometry to reduce file size
ogr2ogr -f GeoJSON simplified.geojson input.shp   -simplify 0.001

Install GDAL on Ubuntu/Debian with sudo apt install gdal-bin, on macOS with brew install gdal, and on Windows through the OSGeo4W installer. ogr2ogr is the right choice for large files, automated pipelines, and batch processing dozens of shapefiles at once.

Convert Shapefile to GeoJSON with Python

Python offers two popular libraries for programmatic shapefile conversion. GeoPandas provides a high-level interface, while pyshp (shapefile) gives lower-level control without a GDAL dependency.

Using GeoPandas

import geopandas as gpd

gdf = gpd.read_file("input.shp")
gdf = gdf.to_crs(epsg=4326)  # Ensure WGS 84
gdf.to_file("output.geojson", driver="GeoJSON")

GeoPandas reads the .shp, .dbf, and .prj files automatically when you provide the .shp path. The to_crs(epsg=4326) call reprojects any coordinate system to the WGS 84 that GeoJSON requires. All attribute columns from the .dbf file are preserved as GeoJSON feature properties.

Using pyshp

import shapefile, json

with shapefile.Reader("input.shp") as sf:
    geojson = sf.__geo_interface__

with open("output.geojson", "w") as f:
    json.dump(geojson, f)

The pyshp library (install with pip install pyshp) reads shapefiles without requiring a compiled GDAL installation, making it ideal for lightweight environments like AWS Lambda or GitHub Actions. The __geo_interface__ attribute exposes the data as a GeoJSON-compatible Python dict.

What Converts and What Doesn't

Shapefile and GeoJSON overlap significantly in their geometry models, but each format has features the other lacks. Understanding the mapping avoids surprises in the output.

Shapefile elementGeoJSON equivalentConverts?
Point / MultiPointPoint / MultiPointYes
PolyLineLineString / MultiLineStringYes
PolygonPolygon / MultiPolygonYes
DBF attribute columnsFeature propertiesYes
Column names > 10 charsTruncated to 10 chars in DBF — no GeoJSON limitPartial (name preserved from DBF)
Coordinate system (.prj)Reprojected to WGS 84Yes (if .prj present)
Spatial index (.shx)Not used in GeoJSONN/A
PointZ / PointM (3D)3D coordinates optional per RFC 7946Partial (Z preserved, M dropped)
Null geometry recordsSkippedNo

Tips for a Clean Conversion

  • Always include the .prj file. Without the .prj, converters cannot determine the source coordinate reference system and will assume WGS 84. If your shapefile uses a projected CRS like EPSG:3857 or a national grid, the output coordinates will be wrong without explicit reprojection.
  • Use a ZIP archive for browser tools. Bundling .shp, .dbf, .prj, and .shx into a single ZIP simplifies the upload. The GeoDataTools converter accepts ZIP archives directly.
  • Check DBF encoding. Older shapefiles use Latin-1 (ISO-8859-1) encoding for text fields rather than UTF-8. If attribute values contain accented characters (é, ü, ñ), specify the encoding explicitly — ogr2ogr accepts --config SHAPE_ENCODING UTF-8.
  • Validate the GeoJSON output. After conversion, load the file into GeoDataTools or a GeoJSON validator to confirm feature counts, geometry integrity, and property values look correct.
  • Simplify large datasets. Shapefiles from cadastral or topographic sources can contain tens of thousands of vertices per polygon. The -simplify flag in ogr2ogr or the simplify() method in GeoPandas reduces file size and improves rendering performance significantly.

FAQ

Which files do I need to convert a Shapefile to GeoJSON?

At minimum you need the .shp (geometry) and .dbf (attributes) files. The .shx spatial index is optional — most converters work without it. Include the .prj file to ensure correct coordinate reprojection to WGS 84. Bundle everything into a ZIP for the easiest upload experience.

Is my data uploaded to a server during conversion?

Not with GeoDataTools. The browser-based converter processes your files entirely in JavaScript inside your browser tab. Nothing is sent to any server, so your data stays completely private — important when working with sensitive land records, proprietary infrastructure data, or confidential survey results.

What if my Shapefile uses a different coordinate system?

GeoJSON requires WGS 84 coordinates (EPSG:4326) per RFC 7946. Browser tools that read the .prj file reproject automatically. If the .prj file is missing, the coordinates are assumed to already be in WGS 84. For shapefiles in projected coordinate systems like State Plane or UTM, use ogr2ogr with the -s_srs flag to specify the source CRS explicitly.

Can I convert multiple shapefiles at once?

The browser tool converts one shapefile at a time. For batch conversion, ogr2ogr in a shell loop is the most efficient approach: for f in *.shp; do ogr2ogr -f GeoJSON "${f%.shp}.geojson" "$f"; done.

What is the difference between a Shapefile and a GeoJSON?

A Shapefile is a multi-file binary format developed by ESRI in the 1990s optimized for desktop GIS performance. GeoJSON is a single-file, human-readable text format defined by RFC 7946 in 2016, optimized for web APIs and JavaScript. For a full comparison, see the spatial data formats guide.

Ready to work with your geospatial data?

Visualize, filter, and convert GeoJSON and KML files directly in your browser.

Try GeoDataTools