Understand CSV Format and Its Uses
What CSV stands for, how a CSV file is laid out, why it has no real data types, what it is used for, and what changes when you convert CSV to TSV.
CSV is one of the most common ways to move tabular data between programs. It is also loosely defined, which is why a file that opens cleanly in one tool can look broken in another. This review covers what the format is, how its layout works, what it is good for, and what to check before you convert, copy or share CSV data, including conversion to and from TSV.
What CSV stands for and what kind of file it is
CSV stands for comma-separated values. A CSV file is a plain-text file. It has no binary structure, no embedded formatting and no formulas of its own. Files usually carry the .csv extension, and the registered media type is text/csv. Because the content is ordinary text, any text editor can open it. A spreadsheet or database tool can also read it as rows and columns.
There is no single binding standard that every program follows. RFC 4180 is an informational document that describes the most widely shared conventions, and many tools roughly follow it. Real-world files still vary in delimiter, quoting, encoding and line endings.
How a CSV file is laid out
- Each line is one record, or row.
- Fields within a record are separated by a comma.
- The first line is often a header row naming the columns. Nothing in the file itself marks whether it is a header or data.
- A field that contains a comma, a double quote or a line break is wrapped in double quotes.
- A double quote inside a quoted field is written as two double quotes.
- RFC 4180 describes CRLF line endings, but many files use LF alone, and most readers accept either.
- Every record is expected to have the same number of fields, though the format cannot enforce this.
The example below shows these quoting rules. The second field of row 1 contains a comma, so it is quoted. The third field contains quotation marks, so they are doubled. The third field of row 2 contains a line break, so that single record spans two physical lines.
id,name,notes,zip
1,"Smith, Jo","Said ""hello""",02134
2,Lee,"Line one
Line two",90210
Characteristics of a CSV file, including data types
CSV has no data types. Every field is a string of characters. Whether 02134 is a number, a postal code or an identifier is decided by the program reading the file, not by the file. The same is true for dates, booleans, currency and empty values. An empty field and a missing value look identical.
- Plain text: readable and editable without special software.
- No schema: column names and meanings depend on convention or separate documentation.
- No declared encoding: the reader must know or guess the character encoding. UTF-8 is common, but not guaranteed.
- No formatting: fonts, colors, cell widths, formulas and multiple sheets are not part of the format.
- Flat structure: one table per file, with no nesting or relationships.
- Delimiter variation: in locales where the comma is the decimal separator, a semicolon is often used instead, though the file may still be called CSV.
What CSV files are used for
CSV is mainly an exchange format. It suits jobs where data has to leave one system and enter another that may not share a native file type. Typical uses include:
- Exporting and importing records between spreadsheets, databases and business applications.
- Bulk uploads such as contact lists, product catalogs or inventory.
- Publishing datasets in a form that most tools can read.
- Moving data into scripts and analysis tools that parse delimited text.
- Keeping simple tabular data in version control, where line-based changes are easy to compare.
What converting between CSV and TSV actually changes
TSV, or tab-separated values, uses a tab character between fields instead of a comma. Converting between the two changes stored characters. It does not just change how the data is displayed. The delimiter is replaced, and quoting may be added, removed or turned into escape sequences. The table is preserved only if the converter handles fields that contain delimiters, quotes or line breaks correctly.
TSV conventions vary more than CSV conventions. One widely cited TSV definition does not allow tabs or line breaks inside fields at all. Some tools apply CSV-style quoting to TSV instead. Others write escape sequences such as a backslash followed by t or n. Before relying on a conversion, check which convention the source tool writes and the destination tool expects.
Below is row 1 from the earlier example, converted to an unquoted TSV convention. The comma in "Smith, Jo" no longer needs quoting, and the doubled quotes become literal quotation marks. The gaps between fields are tab characters.
id name notes zip
1 Smith, Jo Said "hello" 02134
Row 2 is left out of that example on purpose. Its embedded line break cannot be stored in an unquoted TSV field. A converter must quote it, escape it, replace it or reject the row. Each choice changes the data in a different way, so check which one your tool makes.
| Aspect | CSV | TSV |
| Delimiter | Comma, sometimes semicolon | Tab |
| Commas inside fields | Require quoting | Usually need no special handling |
| Tabs inside fields | Allowed | Often forbidden or escaped |
| Line breaks inside fields | Allowed when quoted | Often forbidden or escaped |
| Quoting rules | Broadly shared convention | Varies by tool |
| Readability in a text editor | Fields are easy to see, but quoting adds clutter | Columns may look aligned, but tabs are invisible |
Will the data stay readable and usable after copying or sharing?
Because CSV is plain text, the characters themselves survive copying, email attachments and file transfers well. Meaning is less reliable, because each receiving program reinterprets the text. Check the following before you share a file:
- Type guessing: spreadsheet applications often convert values automatically on open. Leading zeros can be dropped, long numeric IDs can be rounded or shown in scientific notation, and text resembling a date can be turned into a date. Importing columns explicitly as text avoids this in tools that offer the option.
- Encoding: non-ASCII characters can appear garbled if the reader assumes the wrong encoding. Some tools rely on a byte-order mark to detect UTF-8, and others mishandle one.
- Delimiter and locale: a comma-delimited file opened by a tool expecting semicolons may show every row in a single column.
- Embedded line breaks: tools that read line by line, rather than parsing quotes, will split such records apart.
- Formula injection: a field starting with =, +, - or @ may be treated as a formula when the file is opened in a spreadsheet. This is a known risk for files built from untrusted input.
- Clipboard pasting: many spreadsheet tools treat pasted tab-separated text as columns, while comma-separated text may land in one column. This depends on the destination and should be tested there.
Accessibility depends on how the file is opened. In a text editor, a screen reader reads the raw delimiters and quotation marks in sequence, which is hard to follow for wide tables. In a spreadsheet, the same data can be navigated cell by cell with column context, provided the import succeeded. Behavior for any specific assistive technology or application has not been verified here and should be tested. If people need to read the data instead of processing it, provide a properly marked-up table or a short plain-language summary alongside the file.
Is CSV suitable for your use?
CSV is a good choice when the data is a single flat table and it needs to move between different programs. Its main benefit is that almost every tool can read and write it. The main tradeoff is that it carries no types, no encoding declaration and no formatting, so the receiving program has to interpret everything. Errors usually come from that interpretation rather than from the file.
- Choose CSV for exchanging flat tabular data between systems, especially when the receiving side documents its expected delimiter, encoding and columns.
- Choose TSV when fields often contain commas and rarely contain tabs or line breaks, or when the data will be pasted into spreadsheets.
- Keep a native spreadsheet file when formulas, formatting, multiple sheets or cell comments matter.
- Use a structured format such as JSON when data is nested or types must be preserved.
- Use a readable table or plain prose when the audience is people rather than software.
Gaps in this review
This review describes general, documented conventions. It does not test any particular converter, spreadsheet application, clipboard path or screen reader, and it includes no measurements. Claims about how a specific tool imports, pastes or announces CSV and TSV data should be checked in that tool with your own files before you rely on them.