Introduction
The shapefile is the vector map format of Esri, the maker of ArcGIS, introduced with ArcView in the early 1990s. Esri published its specification in 1998, and it became the most common way to exchange points, lines and polygons between GIS programs. It is still everywhere, despite limits such as 2 GB per file and ten-character field names.
A shapefile is not one file but several with the same name:
.shp: the shapes, their geometry.shx: an index giving the position of each shape in the.shp.dbf: the attributes, one row per shape, in dBASE format.prj(optional): the coordinate system, as well-known text
All of them are needed, so shapefiles are usually shared as a ZIP archive.
Structure
The .shp file starts with a 100-byte header. Some of its numbers are
big-endian and some little-endian:
| Offset | Size | Holds |
|---|---|---|
0 | 4 | file code 9994 (00 00 27 0A), big-endian |
24 | 4 | file length in 16-bit words, big-endian |
28 | 4 | version 1000, little-endian |
32 | 4 | shape type, little-endian: 1 point, 3 polyline, 5 polygon, 8 multipoint, and Z and M forms |
36 | 64 | bounding box: minimum and maximum X, Y, Z and M as 64-bit floats |
Records follow. Each has an 8-byte header, the record number and content length,
big-endian, then the content, little-endian: the shape type, then the shape’s bounding
box, parts and points. The .shx file has the same 100-byte header, then
8 bytes per record giving its offset and length.
0Header file code, length, version, shape type, bounding box100 bytes100Records record number, length, then the shaperepeated
The header and shape records page gives every shape type and record layout.
Not described
Re-checked on 2026-11-13 against the Esri Shapefile Technical Description (July 1998).
Known, not yet covered
- Reference: the sidecar files found beside shapefiles (
.prj,.sbn/.sbx,.cpg); the 1998 description does not cover them. - Reference: the figures of the description (polygon and MultiPatch examples) and the byte-by-byte worked examples.
Links
Software
- QGIS – free GIS that opens, edits and saves shapefiles (Windows, macOS, Linux)
- ArcGIS Pro – Esri’s desktop GIS (Windows)
- GDAL – with its
ogr2ogrtool, converts shapefiles to and from other map formats (Windows, macOS, Linux) - Mapshaper – simplifies and converts shapefiles (web)
Developers
Reference
- ESRI Shapefile Technical Description – Esri’s 1998 white paper