Developer guide
TSV vs CSV: Tabs vs Commas and the Quotes Trap
CSV and TSV look nearly identical, and the only real difference is one character: the delimiter. Yet that single character decides who has to quote half their values and who doesn't. This guide explains the practical difference, the “quotes trap” that breaks naive CSV, and when switching to TSV will save you an afternoon of debugging.
Written by Benjamin Rotshtein
Updated
- What's the actual difference?
- TSV separates fields with tabs, CSV with commas. Same rows, same headers, same quoting rules — a different delimiter, and very different quoting needs.
- When is TSV the better choice?
- When your values contain commas — addresses, descriptions, lists — or when you want to avoid quoting entirely in generated files.
- Can I convert between them?
- Yes, and the converters on this site do it correctly — parsing quotes first, then re-joining with the target delimiter. Runs entirely in your browser.
CSV: commas and the quotes trap
CSV (Comma-Separated Values) splits fields on commas. That sounds simple, until a value itself contains a comma:
name,city,notes Alice,"New York, NY","Said ""hi"", then left"
To represent New York, NY the whole field must be wrapped in double quotes. A value containing a quote needs the quote doubled (""hi""). This is the quotes trap: any code that naively splits on , corrupts the data, which is why thousands of scripts and one-off exports break on real-world CSV.
TSV: tabs, where commas are just data
TSV (Tab-Separated Values) uses a tab character as the delimiter. The same record, without any quoting:
name city notes Alice New York, NY Said "hi", then left
The comma in New York, NY and the quotes in the notes column are ordinary characters now — no escaping needed. Tabs are vanishingly rare inside human data, so TSV files are almost always quote-free and trivially safe to parse.
TSV vs CSV — the practical comparison
| Criterion | CSV | TSV |
|---|---|---|
| Delimiter | Comma | Tab |
| Values with commas | Must be quoted | Fine as-is |
| Values with quotes | Must double the quote | Fine as-is |
| Values with tabs | Fine as-is | Must be handled / escaped |
| Standard | RFC 4180 | IANA text/tab-separated-values |
| Excel support | Default, universal | Opens .tsv, splits on tabs |
| Unix / DB tooling | Works, but quoting matters | Often the native delimiter |
When TSV is the smarter choice
- Comma-heavy data: addresses, descriptions, free text and lists all contain commas routinely.
- Generated files: writing TSV from code needs almost no escaping logic — fewer bugs by construction.
- Unix pipelines:
cut -f,awk -F"\t"and many DB importers treat tabs as the default delimiter. - European decimal separators: data like
1.234,56is comma-safe in TSV and fragile in CSV.
When CSV stays the right choice
- Universal compatibility: CSV is the format Excel, Google Sheets and most BI tools open by default.
- No commas in your data: clean numeric and code tables never trigger the quoting trap.
- Interop with legacy systems: ERP and mainframe imports often accept only comma-separated input.
- Industry expectations: when you deliver files to clients, they usually expect .csv.
The newline trap both share
One trap neither format dodges: a newline inside a value. Both CSV and TSV need quoted fields to carry an embedded line break, and many spreadsheet tools still mishandle it. If your data legitimately contains newlines, keep the fields quoted and always test the file in the tool that will actually open it.
Converting between TSV and CSV
A correct conversion parses the source format respecting quotes, then re-joins with the target delimiter and re-quotes only what needs it. The CSV to TSV converter and TSV to CSV converter do exactly that, and they run entirely in your browser.
Frequently asked questions
What is the difference between TSV and CSV?
Only the delimiter. TSV uses a tab character between fields; CSV uses a comma. Everything else — rows, headers, quoting — follows the same family of rules. TSV is a subset of the broader DSV (delimiter-separated values) family.
Why does CSV need quotes but TSV often doesn't?
Because commas appear inside real-world values far more often than tabs do. A value like 'New York, NY' must be wrapped in quotes in CSV, which is exactly the quoting trap that breaks naive parsers. In TSV the comma is just a character, so fewer values need escaping at all.
When should I use TSV instead of CSV?
When your data is full of commas — addresses, descriptions, lists, European numbers (1.234,56) — or when you generate files from code and want to avoid hand-rolled quote escaping. Unix tools and many database importers treat tabs as the native delimiter too.
Does Excel open TSV files correctly?
Excel opens .tsv files by splitting on tabs, which works well when your values contain commas. The main caveat is newlines inside fields: Excel expects quoted fields, and a TSV with embedded newlines can still misbehave.
What does RFC 4180 say about TSV?
RFC 4180 only standardizes the comma-separated variant. TSV has no RFC of its own — the de-facto standard is tab-separated fields with optional quotes, which is what IANA's registered text/tab-separated-values type and most tools implement.
Can a TSV field contain a tab?
Not without escaping. If a value contains a literal tab, the standard trick is to replace it with spaces or escape it in a way your downstream tool understands. This is the one character TSV cannot represent natively, while CSV has the same problem only for commas.