FileHint

CSV vs TSV — which tabular format should you use?

CSV uses commas; TSV uses tabs. The decision hinges on whether your data contains commas, quotes, or newlines — and on how the file will be consumed.

By FileHint editorial teamSupervised by Netwiz LLCEditorial policy

Quick verdict

  • Data often contains commas or newlines → TSV.
  • You want Excel to open the file on double-click, everywhere → CSV.
  • You plan to feed the file through shell pipelines → TSV is easier.

Key differences

Aspect CSV TSV
Delimiter comma , tab \t
Commas in data must be quoted fine
Excel double-click opens opens, may need import wizard
Specification RFC 4180 IANA text/tab-separated-values

CSV weak points

  • Quoting rules (embedded quotes, newlines) trip up hand-written parsers.
  • Encoding varies between apps; UTF-8 without BOM often breaks Excel on Windows.

TSV weak points

  • Excel may not recognize tabs as separators depending on locale; users have to use the import wizard.
  • TSV has no standard escape for embedded tabs, limiting the range of data it can represent.

Converting

  • CSV → TSV: cat file.csv | tr ',' '\t' > file.tsv works only for data without embedded commas. Reach for csvkit for anything else.
  • TSV → CSV: again, csvkit handles quoting correctly.

References