Boneyard Tools

TSV vs CSV: when tabs beat commas

Why tab-separated files avoid the quoting headaches of CSV, where each format shines, and how to move data between them without corruption.

The delimiter is the whole story

CSV and TSV are the same idea with one difference: the character that separates columns. CSV uses a comma, TSV uses a tab. That single choice cascades into everything else about how the files behave. Because commas appear inside ordinary text far more often than tabs do, CSV has to add escaping rules while TSV usually does not. Choosing the right delimiter up front saves you from a whole class of parsing bugs.

Why TSV dodges quoting

In CSV, any value that contains a comma, a quote, or a line break must be wrapped in double quotes, and embedded quotes must themselves be doubled. Get that escaping wrong and columns shift or fields merge. TSV sidesteps most of this because addresses, prices, and prose rarely contain a literal tab. That is why copying a range out of a spreadsheet drops tab-separated text onto your clipboard: it is the safest quick format for messy human data.

Where each format wins

Reach for CSV when a downstream tool demands it, since it remains the most widely accepted interchange format for databases, analytics platforms, and legacy imports. Reach for TSV when your values are full of commas, when you are pasting between spreadsheets, or when you want a format a human can scan in a plain editor without a wall of quote marks. Neither carries data types, so a receiving program still has to decide whether 007 is a number or a string.

Converting without corruption

Moving from TSV to JSON makes the structure explicit: a header row becomes object keys and each data row becomes a record, which is far easier for code to consume than raw delimited text. Keep automatic typing on when you want real numbers and booleans, and turn it off to preserve leading zeros in identifiers. When you need to hand the data to a comma-based tool afterward, run the JSON back through a JSON to CSV step so the escaping is handled for you.

Frequently asked questions

Which format should I pick for a new export?

If you control both ends, TSV is the lower-risk choice for text-heavy data because it rarely needs escaping. If another system requires comma-separated input, use CSV and let a proper library handle the quoting.

Will Excel open a TSV file?

Yes. Excel and Google Sheets both recognize tabs as column separators, and pasting tab-separated text spreads it across cells automatically. Saving with a .tsv or .txt extension keeps the tabs intact.

Do TSV and CSV store data types?

No. Both are plain text, so every value is a string until something parses it. Converting to JSON is where numbers and booleans become real typed values.