Introduction
A .dbf file is one table of the dBASE database, the best-selling database
for personal computers in the 1980s. Many other programs adopted the format, among them
Clipper and FoxPro, so there are several dialects. It is still met today because every
Esri shapefile keeps its attribute table in a
.dbf file.
Long text fields, called memo fields, are kept in a separate file beside the table:
.dbt for dBASE and .fpt for FoxPro. Indexes are also separate
files, such as .ndx, .mdx and .cdx.
Structure
A DBF file has three parts: a 32-byte header, a list of field descriptors and the records. Numbers are little-endian.
| Offset | Size | Holds |
|---|---|---|
0 | 1 | version and flags, such as 03 for dBASE III without a memo file and 83 with one |
1 | 3 | date of last update: year since 1900, month, day |
4 | 4 | number of records |
8 | 2 | length of the header, including the field descriptors |
10 | 2 | length of each record |
Each field descriptor is 32 bytes: the field name (up to 10 characters), a one-letter
type such as C for characters, N for numbers, D
for dates, L for logical and M for memo, and the field length.
The list ends with the byte 0D.
Records are fixed-length and stored as text: each begins with a deletion flag, a space
for a live record or * for a deleted one, followed by every field padded
to its length. The file ends with the byte 1A.
0Header version, date, record count, lengths32 bytes32Field descriptors name, type and length of each field, then0D32 bytes each…Records deletion flag and fieldsfixed length each…End of file1A1 byte
Also used for
Links
Software
- LibreOffice Calc and Base (Windows, macOS, Linux)
- QGIS, for the attribute tables of shapefiles (Windows, macOS, Linux)
- dBASE (Windows)