RFC 4180: The Informal CSV Specification
RFC 4180 is the informal IETF specification that documents how CSV files should be formatted. It's not a binding standard — CSV existed for decades before the RFC was written in 2005 — but it's the closest thing we have to a shared definition, and most modern tools (including CSV.si) follow it.
The 7 rules
- Each record on a separate line, delimited by
CRLF(\r\n).
- The last record may or may not have an ending line break.
- The first line may be a header line with field names.
- Within a record, fields are separated by commas; spaces are considered part of the field.
- Fields may be enclosed in double quotes — required if the field contains commas, double quotes, or line breaks.
- Double quotes inside a quoted field are escaped by doubling them (
"").
- Character encoding is unspecified by the RFC — UTF-8 is the modern default.
Where the spec is fuzzy
RFC 4180 doesn't mandate a delimiter (commas are common but not required), doesn't specify encoding, and doesn't define how to represent dates, booleans, or null. That's why every CSV ecosystem (Postgres COPY, pandas read_csv, etc.) has its own quirks.
Frequently asked questions
Is RFC 4180 mandatory?
No — it's informational. But following it maximizes interoperability.
Where can I read the full RFC?
At ietf.org/rfc/rfc4180.txt. It's only ~6 pages.