Skip to content
uencoder

CSV

CSV (comma-separated values) is a tabular data format that separates fields with commas; RFC 4180 defines the standard, and it is widely used for data import and export.

Purpose

To provide the simplest tabular data exchange format, directly readable and writable by spreadsheets and databases.

Mechanism

Each line is a record, with fields separated by commas. Fields containing commas, quotes, or line breaks are wrapped in double quotes, and a quote inside a quoted field is escaped by doubling it. RFC 4180 specifies CRLF line breaks and an optional header line. Implementations vary in dialect.

Use cases

  • Spreadsheet import and export
  • Database data migration
  • Data analysis (pandas)
  • Bulk API data

Examples

  • Input
    name,age
    Ada,36
    Output
    A two-row, two-column table

    Header in the first row

Common errors

An unquoted field containing a comma shifts the columns
Wrap fields containing the delimiter in double quotes

Related terms

Related tools

References