.dbf file: what it is and which program opens it
By Stellaris Code · Updated
A .dbf file is a data table in dBase format, the one used by dBase, FoxPro and Clipper, and still found in old business applications and in mapping data (it comes with .shp files). It opens in Excel, LibreOffice Calc or a dedicated viewer. This guide explains what it contains, how to open it without breaking anything and what to do if your whole application depends on a folder of .dbf files.
What the .dbf format is
One table per file
Each .dbf holds a header, the field definitions and the records, one after another. It is not a full database: every table is a file.
Simple field types
Character (C), numeric (N), date (D), logical (L) and memo (M). Field names are limited to 10 characters, which gives its age away.
Who still uses it
Business applications in Visual FoxPro, dBase or Clipper, and map files (a .shp always comes with its attribute .dbf).
Not a closed proprietary format
It is very well documented and almost any data tool reads it, which makes rescuing the information easier.
Which program opens a .dbf
Excel
File, Open and pick the .dbf. It works with dBase III/IV types; Visual FoxPro files with memo fields or newer types may fail to open or lose data. Good for looking, not for editing.
LibreOffice Calc
Free. It opens .dbf and lets you choose the character set on import, which is the key when accents come out wrong.
Dedicated viewers
There are free and paid .dbf viewers and editors that show the records, including those marked as deleted, without going through a spreadsheet.
QGIS
If the .dbf comes from a map (.shp), QGIS opens it as an attribute table together with the geometry.
Python and other data tools
Libraries such as dbfread, or pandas with a dbf reader, let you process the data and export it to CSV or a database.
How to open a .dbf in Excel, step by step
Make a copy of the file
Always work on a copy. If the application is running, close it so you do not copy a half-written file.
Open Excel and choose File, Open
In the file type dropdown select All files or dBase files and locate the .dbf.
Check accents and numbers
If you see odd characters, the file uses another code page. Open it with LibreOffice Calc instead and pick the encoding (850 or 1252 are common for Spanish).
Save the result as CSV or Excel
With the data in a sheet you can save it as .xlsx or .csv. Do not save back as .dbf over the original.
What else is in a FoxPro folder
.fpt and .dbt
Memo fields (long text or binary) that do not fit in the .dbf. Without them that data is lost.
.cdx, .idx and .ntx
Indexes. They can be rebuilt, but a damaged index causes odd results in the application.
.dbc, .dct and .dcx
Visual FoxPro database container: relationships, rules and views stored outside the tables.
.prg, .scx and .frx
FoxPro code, forms and reports. If you have them, you have the source code; if only an .exe is left, it has to be recovered.
How to move the data to a current database
Copy the whole folder
The .dbf, .fpt and index files must stay together. A memo without its .fpt cannot be read.
Check the character set
If accents and special letters come out wrong, specify the right code page when reading.
Load the tables into PostgreSQL
Tools such as pgdbf convert .dbf into PostgreSQL tables. You can also go through CSV with Python.
Verify counts and totals
Compare the number of records and key totals with the reports you already use before accepting anything as good.
Recover the program rules
The data is only one part: the logic lives in the executable. Analyse it with the free analyser to see whether it is recoverable.
How to convert a .dbf to CSV or Excel
Fastest: the viewer on this site
Open the .dbf in the free viewer: it is read in your browser, the file is not uploaded to any server, and you can download the data as CSV (with accents that open correctly in Excel).
With Excel or LibreOffice
Open the .dbf, check that accents look right and use Save as, CSV UTF-8 or .xlsx. Always work on a copy.
With Python, for many files
With dbfread or pandas you can loop over a whole folder of .dbf files and export each table to CSV in one go, giving the code page if needed.
Check the result
Compare the record count and a few totals with the original, and look at empty dates and memo fields, which are what fails most often when converting.
Common pitfalls
Wrong accents
Almost always the code page (850, 1252, 437). Changing the encoding when opening fixes it without touching the data.
Deleted records
In the dBase format a deleted record stays in the file marked as removed. You have to decide whether to migrate it.
Dates and numerics
Empty dates and numeric fields containing spaces cause errors when loading into a strict database.
Scattered data
The application may read files from other folders or the network. It is worth inventorying where it reads from and writes to.
We only work on software you own or have the right to act on. This is not legal advice.
Frequently asked questions
What is a .dbf file?
A data table in dBase format, used by dBase, FoxPro and Clipper and also by shapefile maps. Each file stores one table with its fields and records.
Which program opens a .dbf?
Excel (File, Open), LibreOffice Calc, a dedicated .dbf viewer, QGIS if it comes from a map, or Python. LibreOffice is the most reliable option if accents are a problem.
Can I open a .dbf in Excel?
Yes, usually. It works well with dBase III/IV files; Visual FoxPro files with memo fields or newer types may fail. Use it to look at the data and save the result as .xlsx or .csv.
Why do the accents in my .dbf look wrong?
Because the file uses an old code page (for example 850 or 1252) different from the one the program applies when opening it. When importing with LibreOffice you can choose the correct encoding.
Can the code of the FoxPro program be recovered?
In many cases an important part can be recovered from the executable, unless it was compiled with encryption. We assess it in the assessment.
Does Visual FoxPro still work?
Applications keep working as long as they have their runtime, but Microsoft stopped supporting Visual FoxPro. The risk lies in the machines and systems around it.
What do you migrate a FoxPro application to?
Usually to a web application with PostgreSQL or another current database, keeping the business rules and verifying that the data matches.
What does DBF stand for?
DataBase File. It is the extension of dBase tables and was inherited by FoxPro, Clipper and other business programs.
How do I open a .dbf online without installing anything?
With the free viewer on this site: you open it in the browser, the file is not uploaded to any server and you can export the data to CSV.
How do I convert a .dbf to CSV?
The fastest way is to open it in the free viewer and download the CSV. You can also open it in Excel or LibreOffice and save as CSV, or use Python (dbfread or pandas) if you have many files.
Related
- Migrate VB6, Access, Delphi and FoxPro
- Open an .mdb or .accdb without Access
- How to tell what an .exe is built with
Contact
Email: jmoreno@stellariscode.com