All formats

CSV vs YAML

These solve different problems and rarely compete. CSV is for tables with many rows and no nesting. YAML is for configuration with nesting and few rows. If you find yourself choosing between them, the data is probably tabular, which means CSV.

Side by side

SpecCSVYAML
TypeDataData
Extensions.csv.yaml, .yml
Introduced1972 (RFC 4180 in 2005)2001
CompressionNoneNone
MIME typetext/csvapplication/yaml
Use it whenMoving tabular data between systems, or handling files too large for a spreadsheet.Human-edited configuration: CI pipelines, Kubernetes, application config.
Avoid it whenYou need formulas, formatting, multiple sheets or guaranteed types. Use XLSX.Machine-to-machine payloads where JSON is simpler and faster to parse.

Where the usual answer breaks

Small reference lists that people edit by hand, such as a dozen entries with several fields each, read better as YAML.

CSV

  • Readable by essentially every spreadsheet, database and language
  • Plain text, so it diffs and streams well
  • No practical size limit
  • No data types, so leading zeros and long numbers get mangled
  • No multi-sheet support, formulas or formatting
  • Delimiter, quoting and encoding conventions differ between tools
Full CSV guide →

YAML

  • Supports comments, unlike JSON
  • Less punctuation, so configuration reads more cleanly
  • Anchors and aliases let you reuse blocks
  • Whitespace-sensitive, so indentation mistakes break files silently
  • The full specification is large and implementations differ
  • Ambiguous scalars: unquoted values can parse as unexpected types
Full YAML guide →

Other comparisons

Last updated 2026-08-03