What is CSV?

CSV (Comma-Separated Values) is a plain-text format for tabular data. Each line is a row; fields are separated by commas. It is the most universally supported data exchange format — readable by Excel, Google Sheets, databases, and virtually every programming language.

Structure

A typical CSV file looks like:

name,age,city
Alice,30,London
Bob,25,Paris

The first row is conventionally a header row. Fields containing commas or newlines must be quoted with double quotes. A double-quote inside a quoted field is escaped by doubling it: "".

Common Delimiters

  • Comma (,) — standard CSV, used in English-locale exports
  • Semicolon (;) — common in European locales where comma is the decimal separator
  • Tab (\t) — TSV (Tab-Separated Values), avoids comma quoting issues
  • Pipe (|) — sometimes used in data pipelines to avoid delimiter conflicts

Common Gotchas

  • Encoding — Excel often saves as Windows-1252 rather than UTF-8; non-ASCII characters may corrupt on import
  • Line endings — Windows CRLF (\r\n) vs Unix LF (\n) can confuse some parsers
  • Leading zeros — Excel auto-formats numbers, stripping leading zeros from ZIP codes, phone numbers, etc.
  • No schema — CSV has no type information; parsers must infer or be told whether a column is a string, number, or date

Convert CSV to JSON or JSON to CSV instantly: Open CSV ↔ JSON Converter →

Frequently Asked Questions

Does CSV support nested data?

No. CSV is flat — it cannot represent nested objects or arrays. For nested data, use JSON or XML. A common workaround is to store a JSON string inside a CSV field, but this is fragile and hard to query.

What RFC defines CSV?

RFC 4180 defines a common format for CSV, but it is not enforced — many programs produce subtly incompatible CSV. Always test imports from third-party sources.

Related Terms

  • JSON — The structured alternative to CSV for nested data.
  • XML — Another structured format often compared to CSV.