What is the CSV file format?
.csv is a file format that stores various types of data in character-separated text sets, most commonly with a comma - hence the name Comma-Separated Values. The format is documented in RFC 4180 (2005), a minimal but widely adopted standard. Data records are separated by a newline character, while individual field values are commonly enclosed in double-quote characters. To include a literal double-quote inside a field, it is written twice as "".
The first line of a .csv file conventionally holds column names (a header row), although the CSV specification does not mandate its structure. Record fields may be separated by:
- Commas,
- Semicolons,
- Tabs (see .TSV),
- Other characters - used consistently throughout the document.
.csv files are used for storing, importing, and exporting data in a well-defined, platform-independent format that any text editor can open. Because the choice of separator is unrestricted, it can sometimes cause issues during conversion; therefore, data import wizards must offer an option to configure the separator to be used, as is the case with spreadsheet applications such as Microsoft Excel and LibreOffice Calc.
.csv carries no file signature (magic bytes) and is identified by its structure rather than its content. A file may optionally begin with a UTF-8 byte-order mark (EF BB BF), which Excel writes automatically to signal the encoding. Most programming languages provide dedicated libraries for importing and managing .csv files reliably, making it one of the most universal data-exchange formats in use today.
Security & safety
RISK: MEDIUMCSV is plain text and can't itself run code, but it carries a real risk: CSV injection (formula injection). If a cell starts with =, +, - or @, a spreadsheet may execute it as a formula on open - attackers exploit this in exported CSVs to run commands or leak data. Modern Excel/LibreOffice warn before running such formulas; don't enable them in files from untrusted sources. The everyday "risk" is data corruption, not malware: wrong encoding or delimiter silently mangling numbers, dates and leading zeros (e.g. ZIP codes and phone numbers losing their leading 0).
Format details
in a nutshellPrograms that open CSV files
Technical details
deep spec| MIME type | text/csv |
| File structure | Plain text; rows delimited by line endings, fields delimited by a chosen separator character |
| Default delimiter | Comma (`,`); semicolons and tabs are also widely used variants |
| Line ending (RFC 4180) | CRLF (`\r\n` per specification); LF-only (`\n`) is widely accepted in practice |
| Field quoting character | Double-quote (`"`); doubled (`""`) to escape a literal quote within a field |
| Header row | Optional first row conventionally listing column names; RFC 4180 leaves the header structure undefined |
| File signature (magic bytes) | None; identified by structure. An optional UTF-8 BOM (`EF BB BF`) may appear at the start of the file |
| Multi-line field support | Supported when field content is enclosed in double-quotes |
| Data model | Single flat table only; no nesting, relations, or column data types encoded in the format |
| Character encoding | Any encoding agreed between writer and reader; UTF-8 and Windows-1252 are most common |
| Built-in compression | None; files are commonly archived as `.gz` or [ZIP](/format/zip) |
| Streaming suitability | High - rows can be processed line by line without loading the entire file into memory |
| Binary data support | Not natively supported; binary content must be Base64-encoded as text |
| Application row limits | No format-level limit; Microsoft Excel caps sheet import at 1,048,576 rows |
| Released | 1970s (early use); RFC 4180 published 2005 |
| Open standard | Yes · royalty-free |
| Specification | www.rfc-editor.org |
CSV conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about CSV files.