DBF to CSV

Old .dbf text comes in a dozen code pages. The CSV that comes out is always UTF-8, ready for a database import or pandas.

Options
Options
Automatic uses the code page stored in the file (or a shapefile .cpg). Pick another one if accented letters look wrong.
dBASE keeps deleted records in the file until the table is packed. They get an extra "_deleted" column.
Text that starts with =, +, -, @ or a tab gets a leading apostrophe, so Excel shows it as text instead of running it. Numbers are never changed.

Your file is converted on your computer. It is not uploaded anywhere.

How it works

  1. Drop your file in the box above, or click it to pick one.
  2. Pick the output format and press Convert.
  3. Download the result. Nothing was uploaded on the way.

Is it safe?

Shapefile attributes and FoxPro exports can be anything from tree heights to patient lists. Either way the .dbf is unpacked right here in the browser and not uploaded anywhere.

Want to check? Open your browser DevTools, switch to the Network tab and convert a file. Or convert a small file once, because each converter downloads its code the first time, then go offline and convert your real file.

Getting the encoding right once

The point of converting to CSV is often to end the encoding guessing for good. The output is UTF-8, so the next program doesn't need to know what a DOS code page is. The input is the tricky part. "Automatic (from the file)" follows the shapefile's .cpg, then the language byte in the header, then tries UTF-8, and falls back to Windows-1252 with a note when the file gives no clue.

A quick check: open the CSV, look for a name with ä, é, ł or ж. If it's mangled, change Text encoding and run it again. DOS 850 and 437 are the usual suspects for Clipper and FoxPro for DOS data; 852 and 866 for Central European and Russian; Windows-1250 to 1257 for anything from Windows.

Many tables, one go

A FoxPro application or a GIS download rarely comes as a single table. Select up to 50 files at once, or drop a ZIP. Each .dbf is matched with its memo file (.fpt, .dbt or .smt) and its .cpg by name, and each becomes its own CSV. Several tables come back as one ZIP, with conversion-notes.txt added if anything needs a warning. A single table comes back as a plain .csv.

How the values are written

  • Dates as 2024-03-01, date-times as 2024-03-01 14:30:00.
  • Logical fields as TRUE and FALSE, empty when the field was never set.
  • Numbers as plain numbers, without the space padding. A numeric field holding garbage (it happens in old files) is kept as text, and the notes count how many.
  • Text trimmed of the trailing spaces that fixed-width DBF fields are padded with.

Text starting with =, +, - or @ gets an apostrophe in front, so a spreadsheet won't treat it as a formula. Turn off "Protect against spreadsheet formulas" if the CSV goes into a database or script instead.

Left out on purpose

Deleted records, unless you tick Include deleted records; then they're in, flagged in a "_deleted" column. Index files, which only speed up lookups in the original program. The field widths and decimal counts from the header, since CSV has no place for them. Binary memos and pictures appear as a size placeholder, and dBASE 7 timestamps aren't decoded yet.

Tables up to 250 MB each convert on a computer; a ZIP may unpack to at most 800 MB. Encrypted dBASE tables aren't opened.

Questions about this format

How do I get a shapefile attribute table into CSV?

Drop the .dbf from the shapefile, ideally with its .cpg, or the whole shapefile as a ZIP. The CSV has one row per feature. Coordinates aren't included; the shapes live in the .shp file, which this converter doesn't read.

Which code page do FoxPro for DOS files use?

Usually DOS 437 in the US and DOS 850 in Western Europe; Central European installs often used 852. Many FoxPro tables record the code page in their header, in which case Automatic picks it up.

Will CSV keep the DBF field types?

No, CSV only holds text. Dates and logicals are written in a form other programs recognise, but when you import the file you'll set the column types again.

Can it read Visual FoxPro tables with null values?

Yes. Visual FoxPro nulls come out as empty fields, and its varchar, currency, integer, double and date-time types are read too.

Last updated: