What Is a DBF File? Find the Family, Then Open or Convert It
A DBF file is a database table made for dBASE and copied by many programs. Jump to your question below, or work through it in order.
What Is a DBF File? A table from the dBASE family that many programs still read
Short answer
A DBF file is a database table: rows of records in fixed-width columns, first made for dBASE. Several families of programs wrote it, so two DBF files can differ in ways that matter.
The first byte names the family. In our 136 public DBF files, 104 began with 03 and 18 began with 30. The byte 03 is the dBASE III kind with no memo, and 30 is Visual FoxPro. Only 76 of the 136 opened in all four readers we used.
We tested 157 DBF files with LibreOffice and three Python libraries. If your DBF file shows strange letters, read why letters look wrong. If it will not open at all, start with the damage tests. For any other case, start with the first-byte check.
A DBF file is a table of records made for dBASE and copied by many other database programs. The .dbf ending says table. The first byte of the DBF file names the version.
Picture a folder from an old accounting program. It has customers.dbf, and your manager wants the names out of it. Or picture a map download with a .dbf file beside the .shp file. Both are DBF files, and they come from different branches of one family.
The Library of Congress calls DBF a table format that dBASE first used to store data, later adopted by other database programs and vendors. It adds that the format is proprietary and that only the version 7 description is official. Earlier versions were written up by outsiders.
Wikipedia says C. Wayne Ratliff wrote the first version while working at JPL as a contractor. It names Clipper, FoxPro and VP-Info as products that use .dbf files too, and warns that not all .dbf variants are compatible. Our tests agree with that warning.
DBF file facts at a glance
| Property | Value |
|---|---|
| File extension | .dbf |
| Full name | dBASE table file, says the Library of Congress |
| Type | Binary table file with one table per file |
| Made by | dBASE, FoxPro, Clipper, Visual FoxPro and many GIS tools |
| Opens in | Excel for dBASE III and IV, LibreOffice Calc, DBF viewers and GIS tools |
| Layout | A header, a field list and fixed-width records |
| Memo text | A separate .dbt file (dBASE) or .fpt file (FoxPro) |
| Indexes | Separate files like .ndx, .mdx and .cdx |
| Safe to open | Reading is low risk. It is data, not a program. |
| Other meaning | See the section on other uses. |
Wrong page? An Access database ends in .mdb or .accdb, and the MDB file guide and the ACCDB file guide cover them. A spreadsheet that ends in .xls is in the XLS file guide.
Which Kind of DBF File Is Yours? The first byte names the family
Read the first byte of your DBF file. 03 means dBASE III or FoxBASE+ with no memo, 30 means Visual FoxPro and f5 means FoxPro 2.x with a memo file. The byte names the family, and the family decides which programs open the DBF file.
You need no special software. The short script below prints the version byte, the record count, the size check and the field list for any DBF file. Save it as check_dbf.py and give it the name of your DBF file.
import struct, sys
NAMES = {
0x02: "FoxBASE",
0x03: "dBASE III or FoxBASE+, no memo",
0x30: "Visual FoxPro",
0x31: "Visual FoxPro, autoincrement",
0x32: "Visual FoxPro, varchar",
0x43: "dBASE IV SQL table",
0x63: "dBASE IV SQL system",
0x83: "dBASE III with memo",
0x8B: "dBASE IV with memo",
0xCB: "dBASE IV SQL table with memo",
0xF5: "FoxPro 2.x with memo",
0xFB: "FoxBASE",
}
data = open(sys.argv[1], "rb").read()
if len(data) < 32:
sys.exit("Too short for a DBF header")
ver = data[0]
count, hlen, rlen = struct.unpack("<IHH", data[4:12])
print("Version byte: %02x = %s" % (ver, NAMES.get(ver, "not on the common lists")))
print("Update bytes (year, month, day): %d %d %d" % (data[1], data[2], data[3]))
print("Records: %d. Header: %d bytes. Record: %d bytes." % (count, hlen, rlen))
print("Table flags: %d. Code page byte: %d." % (data[28], data[29]))
print("File size: %d bytes. Header math needs %d." % (len(data), hlen + count * rlen))
for i in range(32, hlen - 1, 32):
d = data[i:i + 32]
if len(d) < 32 or d[0] == 0x0D:
break
name = d[:11].split(b"\0")[0].decode("ascii", "replace")
print("Field %s, type %s, length %d, decimals %d" % (name, chr(d[11]), d[16], d[17]))
python check_dbf.py people.dbf
Version byte: 03 = dBASE III or FoxBASE+, no memo
Update bytes (year, month, day): 114 8 2
Records: 3. Header: 97 bytes. Record: 25 bytes.
Table flags: 0. Code page byte: 0.
File size: 173 bytes. Header math needs 172.
Field NAME, type C, length 16, decimals 0
Field BIRTHDATE, type D, length 8, decimals 0
We tried the script on all 136 public files. It named the version for 129 of them. For 6 it said the byte is not on the lists we checked, and one DBF file was too short to read a header. The table shows the kinds in our set, with how many opened in LibreOffice and in all four readers.
| Kind | Files | LibreOffice | All four |
|---|---|---|---|
| dBASE III (03) | 104 | 100 | 73 |
| Visual FoxPro (30) | 18 | 18 | 0 |
| III with memo (83) | 3 | 3 | 3 |
| IV with memo (8b) | 1 | 1 | 0 |
| FoxPro 2.x (f5) | 1 | 1 | 0 |
| Other VFP (31, 32) | 2 | 1 | 0 |
| Unlisted (8c, 90, 04) | 6 | 0 | 0 |
Three more clues about your DBF file
file command, version 5.45 in our test, read the dBASE III header and gave the record count and the update date. Treat its label as a hint.
What Is Inside DBF Files? A header, a field list and fixed-width rows
A DBF file has three parts. The header has the counts. The field list gives the names and widths. The records follow in fixed-width columns, all the same length, so a program can jump to any row.
Think of a printed ledger. The cover says how many pages there are. The first page lists the columns. Then comes row after row, every row the same width. A DBF file is built the same way, and the header records the size of every part.
| Part | Position | What it has |
|---|---|---|
| Version | Byte 0 |
The family, like 03 or 30
|
| Update date | Bytes 1 to 3 | Year, month and day as three numbers |
| Record count | Bytes 4 to 7 | A 32-bit number, low byte first |
| Header size | Bytes 8 to 9 | Where the first record starts |
| Record size | Bytes 10 to 11 | The width of one record with its delete flag |
| Flags | Byte 28 | Index, memo and database bits |
| Code page | Byte 29 | A number for the text encoding |
| Fields | From byte 32 | One 32-byte entry per field |
This follows Microsoft's Visual FoxPro description. It says the record length includes the delete flag. It says the field list ends with the byte 0d and that a field name can have at most 10 characters. The flags byte can add up too: 3 means the table has a structural .cdx index and a memo field.
The field list and the delete flag
Every field entry has the name, a type letter, a length and a count of decimal places. In our DBF file, NAME was type C with length 20 and QTY was type N with length 5. PRICE was type N with length 8 and 2 decimals. ADDED was type D and PAID was type L. The type letters are C for text, N for numbers, D for dates and L for yes or no.
Records start with one flag byte. A space (20) means the record is live, and an asterisk (2a) means it was deleted, says Microsoft. Deleting a row can mean only setting that flag. In our DBF file the text Delete me was still there after the asterisk. The DBF file showed 2 rows in LibreOffice and dbfread and 3 in the dbf library, which keeps deleted rows and marks them.
How a record looks as plain text
In our first record the bytes spelled out as the name Pencil padded with spaces, the number 100, the price 0.35, the date 20260105 and the letter T. Numbers and dates are stored as text. That is why many DBF files stay readable in a text editor, as the next test shows.
A small detail we saw. The update date is stored as three separate numbers. Our dBASE III file stored the year as 126, which is 2026 counted from 1900. Our Visual FoxPro file stored it as 26. LibreOffice also wrote 26 when it made a DBF file for us. Programs do not agree on this byte, so check the year before you trust it.
What Do 157 Test DBF Files Show? 136 public files, 21 we made and four readers
We tested 157 DBF files: 136 from public test sets and 21 we made. LibreOffice opened 124 of the public files. Only 76 of them opened in all four readers we used.
We collected every .dbf file in four public code projects: GDAL, JavaDBF, pyshp and dbfread. We found 189 files, dropped 53 exact copies and kept 136. Then we made 21 more DBF files of our own and tried four readers on all 157.
The readers were LibreOffice 24.2.7 and three Python libraries: dbfread 2.0.7, dbf 0.99.11 and pyshp 3.1.6. We also used the file command 5.45, Python 3.13 and one Linux machine. We downloaded everything in October 2026.
We did not test Excel, Access, dBASE, Visual FoxPro, DBF Viewer 2000, the SysTools or Freeviewer viewers, a GIS program, Windows or a Mac. The public files come from test folders built to cover odd cases, so the counts show how tools behave and not how common any kind is.
What the 136 public DBF files were
| Project | Files | Why it has them |
|---|---|---|
| GDAL | 88 | Tests of map and table drivers |
| JavaDBF | 40 | Tests of a Java reader and writer |
| pyshp | 5 | Tests of a shapefile library |
| dbfread | 3 | Tests of a Python reader |
The files ranged from 15 bytes to 2,355,059 bytes and from 0 to 6,630 records. The middle file had 5 records, and 9 files had none. The widest table had 172 fields. Four files had deleted records, and 48 had no code page set.
By the flags byte, 15 files said they had a structural .cdx index and 8 said they had a memo field. We had only the .dbf files, so we could not test the files they point to.
The 21 DBF files we made
We made them with the dbf Python library to test cases that no public set gave us. None came from dBASE, FoxPro or any other program. A DBF file made by the original program may differ from ours.
| Group | What it is | Why |
|---|---|---|
| base | 3 records with text, numbers, dates and yes or no | The base case |
| memo | dBASE III with a .dbt file, and FoxPro 2.x with an .fpt file | Memo text |
| visual-foxpro | Fields of type I, Y, T and B | VFP types |
| accents | Three code pages: cp1252, cp850 and cp1251 | Letters |
| deleted | Three records, one with the delete flag | Deleted rows |
| empty | A table with fields and no records | Zero rows |
| wide | A 254-character field and a 20-digit number | Limits |
| ten-chars | A field name with 10 letters | Name limit |
| ten-thousand | 10,000 records in one DBF file | Size |
| damaged | Nine copies of the base file, broken in nine ways | Damage tests |
We also saved three renamed copies of the base file as .dat, .xls and .csv. They appear in the conversion section.
What the four readers opened
| Reader | Opened | Failed |
|---|---|---|
| LibreOffice | 124 | 12 |
| dbf | 120 | 16 |
| dbfread | 117 | 19 |
| pyshp | 87 | 49 |
Seventy-six files opened in all four readers. A total of 129 opened in at least one, and 7 opened in none. All seven were built to be odd. Three had the byte 8c, one had a wrong type byte, one had the byte 04 and two had no header terminator.
How the two big families fared
| Reader | dBASE III (104) | Visual FoxPro (18) |
|---|---|---|
| LibreOffice | 100 | 18 |
| dbf | 98 | 17 |
| dbfread | 94 | 16 |
| pyshp | 80 | 1 |
pyshp read 1 of the 18 Visual FoxPro files. That is no fault. pyshp is built for shapefile tables, which use the basic dBASE types. Of its 49 failures, 24 were a field type it does not know and 20 were text it could not decode.
LibreOffice failed on 12 files. It refused every DBF file with a version byte it does not know: 8c, 90 and 04. It also refused the one Visual FoxPro varchar file, two files with a missing header terminator and one with a wrong type byte.
Read the counts with care. These files were collected to test readers, so odd and broken files are over-represented. Two projects supply 128 of the 136 files. The numbers show how tools behave with these files, and they are not shares of all DBF files.
What Does Our Expert Say About DBF Files? A note from Neeraj Singh on checking a copy first
Read the first byte, open a copy and check the letters and dates before you trust the result. The byte names the family, and the check shows whether the reader understood it.
Expert insight
“A DBF file is a table, and its first byte names the family that made it. In our test, 104 of the 136 public files began with 03, the dBASE III kind with no memo. Do not judge a DBF file by its ending, and do not judge it by one reader. Only 76 of the 136 opened in all four of ours. Work on a copy. Check the letters and dates after you open it. Then convert it.”
Why an open file can still be wrong
A DBF file can open without an error and still show the wrong data. LibreOffice opened our Visual FoxPro file and showed 3500 for a price of 0.35. In our command-line test it also read our cp1252 file with garbled letters. Neither case gave a warning.
So the first move costs nothing. Copy the DBF file, read the first byte and open the copy. Compare two or three rows with what you expect, especially prices, dates and any name with an accent. If they match, convert the DBF file with the convert steps.
Keep the original. Work on a copy of every DBF file, and keep the original beside any .dbt, .fpt or index files. The memo files must stay with the table, as the memo files section explains.
How Do You Open DBF Files? LibreOffice, Excel, viewers or short Python code
Open a DBF file in LibreOffice Calc or in a DBF viewer. Excel also works for dBASE III and IV files. For many files at once, use Python. Always open a copy.
Your computer cannot choose the right program from .dbf alone, and some programs read only some families. Spend a minute on the first-byte check before you open anything. The table sends every family to the programs we know about.
| Program | Reads | What we saw |
|---|---|---|
| LibreOffice Calc | Most families | Opened 124 of 136 public files. It also writes DBF. |
| Microsoft Excel | dBASE III and IV | Microsoft says it opens them and cannot save them. Not tested. |
| SysTools viewer | dBASE files | Its page says free. Not tested. |
| Freeviewer viewer | dBase to VFP | Its page says free. Not tested. |
| Python libraries | Depends | dbf opened 120, dbfread 117 and pyshp 87 of 136. |
| dBASE, Access, FoxPro | Their own | Not tested. |
Open DBF files with LibreOffice Calc
Calc reads the table as a sheet, with one row for every record. In our command-line test the header cells came out as NAME,C,20: the field name, the type letter and the length. Shorten them to the field name before you use the data.
Calc also wrote DBF files for us from a CSV file, as the convert section shows. Wikipedia says LibreOffice and OpenOffice can read and write generic .dbf files, and our test agrees. The letters can come out wrong, so read the code page section.
Open DBF files in Excel
Microsoft says you can open dBASE III and IV files in Excel but cannot save an Excel file in dBASE format. It lists the DBASE II format as unsupported in Excel 2016, 2013, 2010 and 2007. We did not test Excel, so check the first byte before you try: 03, 83 and 8b are the dBASE III and IV kinds in our set.
Free viewers and reference pages
These four links open outside pages: two viewers, Microsoft's note on Excel and the Library of Congress record.
SysTools calls its viewer a standalone tool to open and view dBASE DBF files without dBASE. Its page lists a page code setting, sorting, search and a one-click undo. It also says a damaged DBF file will fail to open, and it does not say which DBF versions it reads. We did not test it.
Freeviewer's page describes a portable Windows viewer for dBase, Clipper, FoxPro and Visual FoxPro files. It lists index files (.cdx, .mdx, .ndx and .ntx), which must be linked to an open .dbf file first. It also lists editing the field structure. It shows the cost as free. We did not test it either.
Open DBF files with Python
A code library reads many DBF files in one go. In our test dbf opened 120 of 136 public files, dbfread 117 and pyshp 87. dbfread is the shortest to use. Install it with pip, then loop over the rows.
from dbfread import DBF
for row in DBF("people.dbf", encoding="cp1252"):
print(dict(row))
Set the encoding to match the code page byte, or the letters can come out wrong. For our Visual FoxPro file, dbfread also needed the option ignore_missing_memofile=True. Without it, dbfread stopped with a missing memo file error, though the DBF file had no memo field.
Can You Read a DBF File in a Text Editor? Partly, and the header looks like noise
Many DBF files read as text, because numbers and dates are stored as characters. In our test, 84 of 126 public files with rows had only printable characters in the rows. The header looks like noise.
The Library of Congress page says files with fixed-length character fields and numbers stored as strings can be viewed in a text editor. Our files agree, up to a point. The rows are the readable part.
Pencil 100 0.3520260105T
Notebook 40 2.5020260209F
Stapler 7 12.9920260301T
Look at the second row. The price 2.50 and the date 20260209 touch, because fields have no separators. You find the borders with the field list: 20 characters of name, 5 of quantity, 8 of price, 8 of date and 1 for yes or no. Dates come as year, month and day with no dashes.
| Part | Shows as | Note |
|---|---|---|
| Header | Noise | Counts and padding bytes |
| Field names | Readable | Nulls between them |
| Text | Readable | Padded with spaces |
| Numbers | Readable | Right-aligned |
| Dates | Readable | Year, month, day |
| VFP types | Noise | Raw bytes in I, Y, T, B |
| Accents | It depends | The code page decides |
Our Visual FoxPro file shows the limit. Its integer, currency, date-time and double fields are stored as raw bytes, and 49 percent of the bytes in its rows were not printable. In the other 42 public files with rows, some bytes were not printable.
Look, do not save. Use a text editor to read a DBF file and not to save one. We did not test saving, and the record length, the 0d terminator and the 1a end mark all depend on exact bytes.
What Are the .dbt, .fpt and .cdx Files Beside a DBF File? Memo and index files that must stay with the table
Memo text and indexes live in separate files that must stay beside the DBF file with the same name. Without the memo file, two of our three Python readers stopped with an error, and LibreOffice showed empty memo cells with no warning.
A memo field stores long text, and a DBF record stores only a pointer to it. The text itself lives in another file. The SAS documentation says memo files end in .dbt for dBASE and .fpt for FoxPro, and share the base name of the table.
| Ending | What it is | Source |
|---|---|---|
.dbt
|
dBASE memo text | SAS documentation |
.fpt
|
FoxPro memo text | Microsoft's file types list |
.cdx
|
FoxPro compound index | Microsoft's file types list |
.mdx .ndx .ntx
|
More index files | Freeviewer's page |
Microsoft's header description says the flags byte shows what a table needs: 1 for a structural .cdx index, 2 for a memo field and 3 for both. Our check script prints that byte as table flags. If it says 2 or 3, look for the memo file before you open the table.
What happens when the memo file is missing
We made one dBASE III table with a .dbt file and one FoxPro 2.x table with an .fpt file. Then we removed the memo files and opened both tables in all four readers.
| Reader | dBASE III | FoxPro 2.x |
|---|---|---|
| LibreOffice | Empty memo | Empty memo |
| dbfread | Error | Error |
| dbf | Error | Error |
| pyshp | Block numbers | Failed |
The silent case is the risky one. LibreOffice gave no error and no warning in our command-line test, so a table with missing memo text looks complete. The pyshp library showed the memo block numbers, 1 and 2, in place of the text.
Copy them together. When you move or send a DBF file, move its .dbt, .fpt and index files with it. When you convert the table, the memo text only comes along if the memo file is present.
Why Do Letters Look Wrong in a DBF File? The code page byte, and the reader that ignored it
Text in a DBF file depends on the code page byte at position 29. If that byte is wrong or 0, readers guess. In our test, one wrong byte changed "Café Crème" into "CafÚ CrÞme".
DBF files do not store Unicode text. They store one byte for every character, and a code page says which letter a byte means. The same byte is é in one code page and Ú in another. The header has a number for the code page, and a reader should use it.
We made the same three names in three files: Café Crème in cp1252 and in cp850, and a Cyrillic word in cp1251. Then we opened all of them in four readers. The table shows three, because pyshp failed on all three files with its default.
| File | LibreOffice | dbfread | dbf |
|---|---|---|---|
| cp1252 | Wrong | Right | Right |
| cp850 | Right | Right | Right |
| cp1251 | Wrong | Right | Right |
dbfread and dbf read the code page byte and got all three right. LibreOffice read only the cp850 file right. We then set the byte in our cp1252 file to 02, and dbfread printed the same wrong text LibreOffice gave for the untouched file. So LibreOffice acted as if every DBF file were cp850 and did not use the byte.
pyshp failed on all three with its default of UTF-8. When we gave it the right encoding, it read all three correctly. When we set the byte to 00, dbfread also failed, with an ASCII error. A zero means no code page was set.
Fix wrong letters in four steps
- Read byte 29 with the check script. It prints the code page byte.
- Match it to a code page. In our files 03 meant cp1252, 02 meant cp850 and c9 meant cp1251, as the dbf library labelled them.
- Open the DBF file in a reader that lets you set the encoding, like dbfread with encoding="cp850".
- If the letters still look wrong, try the other code pages. For a byte of 00, try Windows cp1252 first and DOS cp850 second.
A trap when you convert back. LibreOffice wrote a DBF file from our CSV with the code page byte at 00, though it wrote the text as cp850. dbfread failed on it until we set encoding="cp850". Read the conversion section before you send such a DBF file on.
Why Will Your DBF File Not Open? Nine damage tests, and a fix that took a few bytes
A DBF file that will not open usually has a wrong header byte, a cut-off end or a missing companion file. In our tests, fixing 1 to 4 header bytes brought back every damaged copy that still had its field list.
Most failures come from a mismatch between the DBF file and the reader. We broke nine copies of a small dBASE III file, one way every time. Then we tried four readers on them. The chart shows who opened what.
Fix the header bytes of a DBF file
Four of our damaged copies had a good header with one wrong number. We set the number back with a few lines of Python and tried all four readers again. Every reader opened every fixed copy and returned 3 of 3 rows.
| Damage | Sign | Fix |
|---|---|---|
| Wrong count | Count 1000, 3 rows | Set bytes 4 to 7 |
| Wrong version | Byte 0 is 00 or 99 | Set byte 0 to 03 |
| Wrong length | Bytes 10 to 11 are off | Add the field lengths and 1 |
| Cut rows | File is short | Trim, then set the count |
| Cut header | Under 193 bytes | No fix |
import struct
data = bytearray(open("broken.dbf", "rb").read())
struct.pack_into("<I", data, 4, 3) # record count
open("fixed.dbf", "wb").write(data)
The record length is the sum of the field lengths plus 1 for the delete flag. In our DBF file that is 20, 5, 8, 8 and 1, plus 1, which makes 43. Work on a copy, and read the header again with the check script after the fix.
A DBF file cut inside the rows
We cut our 10,000-row file after 5,000 rows plus 7 bytes. LibreOffice and pyshp failed. dbfread returned 5,001 rows, and the last one came back blank. After we trimmed the partial record and set the count to 5000, all four readers returned 5,000 rows.
SysTools says on its page that a damaged DBF file fails in its viewer, so repair the header first. We did not test it.
Compare sizes. Multiply the record count by the record length and add the header length. If the DBF file is shorter, rows are missing. If it is longer by one byte, that byte is probably the 1a end mark.
How Do You Convert DBF Files? To CSV and XLSX, and back to DBF
Convert DBF files to CSV or XLSX with LibreOffice or Python, and CSV back to DBF with LibreOffice. Then check the letters, the dates and any memo or currency column. Keep the original.
You have three routes: LibreOffice from the command line, Python with a few lines of code or a viewer that exports. The table lists the routes we tested.
| Route | Tool | Result |
|---|---|---|
| DBF to CSV | LibreOffice | 124 of 136 public files |
| DBF to XLSX | LibreOffice | Worked on our DBF file |
| DBF to CSV | dbfread and csv | Worked on our DBF file |
| DBF to XLSX | dbfread and openpyxl | Worked on 10,000 rows |
| CSV to DBF | LibreOffice | Worked on our DBF file |
Convert with LibreOffice
soffice --headless --convert-to csv people.dbf
soffice --headless --convert-to xlsx people.dbf
soffice --headless --convert-to dbf people.csv
The first two write a CSV file and an XLSX file. The third writes a DBF file from a CSV file. Dates in the CSV came out as month, day and year, so 5 January 2026 showed as 01/05/2026. Readers in other countries can misread that.
We also saved copies of the base file as .dat, .xls and .csv. LibreOffice read the .dat and .xls copies as DBF, because it checks what is inside. It read the .csv copy as text, and the result was garbage. The ending can win, so keep the .dbf ending.
Convert with Python
import csv
from dbfread import DBF
table = DBF("people.dbf", encoding="cp1252")
with open("people.csv", "w", newline="", encoding="utf-8") as f:
out = csv.writer(f)
out.writerow(table.field_names)
for row in table:
out.writerow(row.values())
This keeps dates in the form 2026-01-05 and writes yes or no fields as True and False. Swap the csv writer for openpyxl to get an XLSX file. We did that for our 10,000-row file and got 10,000 rows back.
Convert CSV back to DBF
LibreOffice sized the fields to the data in our CSV file: 8 characters for the longest name, 3 for the quantity and 4 for the price with 2 decimals. A later row with a longer name will not fit, so widen the fields first. The CSV had no date or yes-or-no types, and so the DBF file did not either.
The DBF file began with 03, the dBASE III byte. It stored the year as 26, as our Visual FoxPro file did. Its code page byte was 00, though the text was written in cp850. dbfread read it right once we set that encoding.
What to check after you convert
What Else Uses the DBF Ending? Shapefile tables, FoxPro tables and other relatives
The .dbf ending covers dBASE tables, FoxPro tables and shapefile attribute tables, and many tools write it. Name the source before you choose a program, because the family sets what opens the DBF file.
Many programs share the .dbf ending. The format began in dBASE, and Wikipedia's dBase article names Clipper, FoxPro and VP-Info among the products that use it, with the open-source Harbour, xHarbour and Clip. It warns that not all variants are compatible.
| Kind | Made by | Note |
|---|---|---|
| dBASE tables | dBASE | Byte 03, 83 or 8b in our set |
| FoxPro tables | Microsoft | 18 of 136 began with 30 |
| Clipper tables | Clipper | Named by Wikipedia |
| Shapefile tables | GIS tools | Needs .shp and .shx files |
| Others | Many tools | Bytes 8c, 90 and 04 in our set |
The .dbf file next to a .shp file
A map download often has three files with one name: .shp, .shx and .dbf. Wikipedia's shapefile article calls all three mandatory and says the .dbf file stores the attributes of every shape in dBase IV format. A .shp file alone is incomplete.
The same article gives limits: field names of at most 10 characters, up to 255 fields and text of up to 254 characters. It says a .cpg file names the code page, because Unicode support is poor. So a shapefile table follows the letters advice too. Two of our four test projects, GDAL and pyshp, work with map data.
A DBF file is not an Access file
A DBF file is one table. An Access database can have many tables, queries and forms in one DBF file, and it ends in .mdb or .accdb. If a program says your DBF file is not a database, you may have the wrong ending. Read the first byte before you rename anything.
What Is the DBF File Format Made Of? The header facts, and what we could check
DBF has no single standard. Only the dBASE 7 description is official, and the rest was written up by others. These are the facts we could check against Microsoft, the Library of Congress and our own files.
| Item | What we could check |
|---|---|
| Name | dBASE Table File Format (DBF), says the Library of Congress |
| Extension | .dbf |
| Makers | Ashton-Tate owned dBASE in the 1980s, and dBase LLC followed in 2012, says the Library of Congress |
| Status | Proprietary. Only version 7 is official, and earlier ones are written up by outsiders. |
| Structure | A header, a list of 32-byte field entries and fixed-width records |
| Version byte | Byte 0. 03 is dBASE III or FoxBASE+ with no memo, and 30 is Visual FoxPro. |
| Counts | Record count in bytes 4 to 7. Header size in 8 to 9. Record size in 10 to 11. |
| Field entry | Name of up to 10 characters, type letter, length and decimals |
| Delete flag | The first byte of a record. A space is live and an asterisk is deleted. |
| Code page | Byte 29, called the code page mark by Microsoft |
| Memo files | .dbt for dBASE and .fpt for FoxPro |
| Index files | .cdx, .mdx, .ndx and .ntx |
| Text editor | Partly readable. Fixed-length text and numbers stored as strings can be viewed. |
About version bytes outside the list
Microsoft lists the version bytes 02, 03, 30, 43, 63, 83, 8b, cb, f5 and fb. The dbf2002 page adds 31, 32 and e5. Our public files also had 8c, 90 and 04. One DBF file with 8c is named dbase_7, but we found no document to confirm what the other two bytes mean, so we do not guess.
LibreOffice refused all six of those files. dbfread opened one of the six and pyshp opened two, so a strict reader is not always the right one. The facts table lists only what we could check.
What we left out
We did not test Excel, Access, dBASE, Visual FoxPro, DBF Viewer 2000, a GIS program, Windows or a Mac. We did not test the LibreOffice desktop window either. Our results come from its command-line converter, version 24.2.7, and the desktop import dialog may offer more choices.
We had no index files, so we cannot say how any reader treats a missing .cdx or .ndx. We had no file made by dBASE or FoxPro. Our own files came from the dbf Python library. We did not read the dBASE 7 specification.
We did not test the SysTools or Freeviewer viewers. What we say about them comes from their pages. We name no prices, because the pages gave none we could check.
Sources checked
For the header and fields, see Microsoft's table file structure page. For version bytes beyond Microsoft's list, see the version byte list on dbf2002. For the memo files, see the SAS note on memo files and the Microsoft file extensions page.
For history and status, see the Library of Congress DBF record and the Wikipedia entry on dBase. For Excel, see Microsoft's list of supported Excel formats. For maps, see the Wikipedia entry on shapefiles. Every test count came from the 157 files and the scripts in our research folder.
Frequently Asked Questions About DBF Files
What is a DBF file?
A DBF file is a database table in the format that dBASE made popular. It has a header, a list of fields and records of equal width. Many programs write it, including FoxPro, Clipper and map tools. The first byte of the DBF file names the family.
What does the DBF extension mean?
The .dbf ending marks a dBASE-style table file. The Library of Congress calls the format the dBASE Table File Format. It says other database programs and vendors adopted it later. Two DBF files from different programs can still differ in ways that matter.
How do I open a DBF file?
Check the first byte, then open a copy in LibreOffice Calc or a DBF viewer. Excel also opens dBASE III and IV files. In our test LibreOffice opened 124 of 136 public files. For many files, use a Python library like dbfread. Set the encoding to match the code page byte.
What program opens a DBF file?
LibreOffice Calc, Excel, FoxPro, dBASE and DBF viewers all open some kinds. In our test, dbf opened 120 of 136 public files, dbfread 117 and pyshp 87. Only 76 files opened in all four readers we used. We did not test Excel, Access or the paid programs.
Can Excel open a DBF file?
Excel can open dBASE III and IV files, says Microsoft, but it cannot save a workbook in dBASE format. Microsoft lists the DBASE II format as unsupported in Excel 2016, 2013, 2010 and 2007. We did not test Excel. Save your data as CSV or XLSX instead.
How do I convert a DBF file to CSV or Excel?
Use LibreOffice from the command line: soffice --headless --convert-to csv people.dbf, or xlsx in place of csv. You can also use dbfread with the csv or openpyxl modules. Check the letters, the dates and any memo column afterward. Dates came out as month, day and year in our CSV files.
How do I convert a CSV file to DBF?
LibreOffice can write a DBF file from a CSV file with the command soffice --headless --convert-to dbf people.csv. It sized the fields to the data, and wrote the code page byte as 00 though the text was cp850. dbfread read the result once we set encoding to cp850. Widen the fields before you add longer text.
Why do the letters look wrong in my DBF file?
The reader used the wrong code page. DBF files store one byte for every character, and byte 29 of the header names the code page. In our test LibreOffice read a cp1252 file as if it were cp850 and showed CafÚ CrÞme for Café Crème. Open the DBF file in a reader where you set the encoding, and try cp1252 and cp850.
Why is the memo text missing from my DBF file?
The memo text lives in a .dbt file for dBASE or an .fpt file for FoxPro, and the memo file must stay beside the table with the same name. Without it, dbfread and dbf stopped with an error in our test, and LibreOffice showed empty memo cells with no warning. Find the memo file and keep it with the table.
Why will my DBF file not open?
The usual causes are an unknown family, a missing memo file and a wrong number in the header. In our test, fixing the record count, the version byte or the record length made all four readers open the damaged copies again. A DBF file cut inside the header, or one made of random bytes, could not be saved.
Is a DBF file safe to open?
Reading a DBF file is low risk. It is data, not a program. Anyone can give any DBF file the .dbf ending, so do not open an unexpected one from a stranger. Work on a copy, and keep the original and its memo files together.
Is the DBF file next to my .shp file a shapefile?
It is part of one. Wikipedia says a shapefile needs .shp, .shx and .dbf files, and the .dbf file stores the attributes of every shape. Keep the three files together with the same name. A .cpg file may name the code page for the text.
Still Stuck With a DBF File? Eight routes out, depending on what went wrong
Start with the damage test results. The header bytes, the memo file and the family explain most cases.
Go to the convert routes. One command writes a CSV or XLSX file from the DBF file.
Is it an Access database? The Access MDB database guide covers older files.
Does it end in .accdb? The Access ACCDB database guide explains the newer kind.
Is it an Excel sheet? The Excel XLS spreadsheet guide shows how to open one.
Is it a database under another name? The guide to reading SQLite databases shows how to read one.
Is it a generic data file? The DAT data file guide explains how to read the first bytes of a file with an unclear name.
Is it a file type you do not know? Browse the file extension resource library, or send it to us on the submit a file type page.