Shapefile Format: .shp, .shx, .dbf and .prj Explained
The shapefile is Esri's vector data format from the early 1990s. Despite its age it is still one of the most common ways to exchange GIS data: boundaries, roads, parcels and survey points are routinely published as shapefiles.
A "shapefile" is not one file but a set of files with the same name and different extensions. That is why shapefiles are almost always shared as a ZIP, and why people search for "zip to kml" when they mean a zipped shapefile.
roads.shp geometry (points, lines or polygons) required
roads.shx index into the geometry required
roads.dbf attribute table in dBASE format required
roads.prj coordinate system as WKT text strongly recommended
roads.cpg text encoding of the .dbf, e.g. UTF-8 optional
roads.sbn spatial index optionalConvert Shapefile files
- Convert Shapefile to KML— Convert a Shapefile ZIP to KML for Google Earth
- Convert Shapefile to GeoJSON— Convert a Shapefile ZIP (.shp + .dbf) to GeoJSON
- Convert Shapefile to GPX— Convert a Shapefile ZIP to a GPS track file
- Convert Shapefile to CSV (lat/lng)— Extract Point features from a Shapefile ZIP to a lat/lng CSV
- Convert GeoJSON to Shapefile— Convert a GeoJSON file to a Shapefile ZIP (.shp, .shx, .dbf, .prj)
- Convert KML to Shapefile— Convert a Google Earth KML file to a Shapefile ZIP for QGIS and ArcGIS
- Convert CSV to Shapefile— Convert a CSV with latitude/longitude columns to a point Shapefile ZIP
Why the .prj file matters
Shapefile coordinates are just numbers. The .prj file says what they mean: longitude/latitude in WGS 84, metres in a UTM zone, feet in a State Plane zone, and so on. Without it, software cannot place the data on a map correctly, and a converted KML or GeoJSON can end up in the ocean or off the map entirely. Always keep the .prj file in the ZIP.
Limitations of the format
Because of these limits, GeoPackage (a single SQLite file) is the recommended modern replacement, and GeoJSON is the usual choice for web maps.
- One geometry type per shapefile: points, lines and polygons need separate files
- Attribute field names are limited to 10 characters
- Text attributes are limited to 254 characters, and there is no date-time type, only dates
- Each component file is limited to 2 GB
- Text encoding is ambiguous unless a .cpg file says what it is
How to open a shapefile
- QGIS (free): drag the .shp file, or the whole ZIP, into the map
- ArcGIS Pro or ArcMap
- Google Earth Pro: File → Import, then choose the .shp file
- mapshaper.org: drop all files at once to view and simplify them in the browser
- GDAL/ogr2ogr on the command line
Frequently Asked Questions
- Which files do I need to open a shapefile?
- At minimum the .shp, .shx and .dbf files with the same base name. Include the .prj file so the coordinate system is known; without it the data may appear in the wrong place.
- How do I open a zipped shapefile in Google Earth?
- Google Earth cannot open a shapefile ZIP directly. Convert the ZIP to KML, then open the KML in Google Earth, or unzip it and use File → Import in Google Earth Pro.
- Can a shapefile contain points and lines together?
- No. A shapefile holds one geometry type. Data with mixed types is split into separate shapefiles, for example one for points and one for lines.