CSV (Comma-Separated Values) is a plaintext format for tabular data, where each line is a record and fields within a record are separated by commas. It predates any formal specification by decades — different tools historically implemented subtly different quoting and line-ending rules — but RFC 4180 (2005) documents the common conventions most modern parsers follow.
Fields are separated by a delimiter (a comma by default, though ; and tab-separated TSV are common variants) and records by a line break. A field that contains the delimiter, a double quote, or a line break must be wrapped in double quotes, and a literal double quote inside a quoted field is escaped by doubling it:
name,age,bio
"Ada Lovelace",36,"Wrote ""notes"" longer than the paper they annotated"
"Grace Hopper",85,Computer scientist
The first line is conventionally, but not universally, a header row naming each column — nothing in the format itself distinguishes a header from a data row, so the convention has to be agreed on out of band. Unlike JSON or XML, CSV has no native way to represent nested structures — a row is always flat, which is exactly the tradeoff that makes it simple to open in a spreadsheet.
"007" and 007 are indistinguishable from a 7 unless the parser preserves leading zeros as a string.\n vs \r\n) and delimiter differences (, vs ;, common in some European locales) between systems produce CSV files that look right but parse incorrectly elsewhere.