CSV to TSV Converter

Convert comma-separated CSV into tab-separated TSV. Quoted fields are parsed correctly, and the output is ready to paste into a spreadsheet or load with command-line tools.

Copied
CSV Input0 B
TSV Output0 B

What is TSV, and why convert CSV to it?

TSV (tab-separated values) stores a table as plain text with one row per line and a tab character between fields. Its media type, text/tab-separated-values, is registered with IANA, and that registration simply says a field may not contain a tab. Unlike CSV, as described in RFC 4180, the common form of TSV has no quoting: there is no way to protect a tab or a line break inside a value.

That lack of quoting is exactly why TSV is handy. A line is always one record and a tab is always a column boundary, so command-line tools such as cut -f2 (tab is its default delimiter) and awk -F'\t' work without a CSV parser, and pasting TSV into a spreadsheet fills one cell per field. This converter does the careful part — reading CSV quotes correctly — and gives you clean TSV.

How to use the converter

  1. Paste comma-separated data into the CSV Input pane, or load a file with File or a remote file with URL.
  2. Click Convert.
  3. Use Copy, or Download to save converted.tsv. Clear empties both panes.

There are no options: the input delimiter is always a comma and the output delimiter is always a tab.

What changes during conversion

Example

id,name,note
1,"Lovelace, Ada","Said ""that brain of mine"""
2,Turing,"Line one
line two"

becomes (with → standing for a tab):

id→name→note
1→Lovelace, Ada→Said "that brain of mine"
2→Turing→Line one line two

The comma inside Lovelace, Ada no longer needs protecting, the doubled quotes collapse to ordinary ones, and the two-line note is joined with a space.

Loading the TSV into a database

PostgreSQL's COPY ... FROM in its default text format and MySQL's LOAD DATA with default settings both expect tab-separated fields. Both also treat the backslash as an escape character, and PostgreSQL reads \N as NULL. If your values contain backslashes, such as Windows paths, either double them before loading or load the original CSV with the database's CSV mode (FORMAT csv in PostgreSQL) instead.

Common problems and fixes

SymptomCauseFix
The output has no tabs, or splits in odd placesThe input uses semicolons, which this page does not read.Open the file in a spreadsheet and copy the cells: a copied range is already tab-separated. Or check it first in the CSV Formatter.
Error saying a quoted field is never closedA value opens with " and never closes.Add the missing quote on the line given in the message.
Multi-line text became one lineLine breaks in values are replaced with spaces on purpose.Keep the CSV, or convert to JSON, if the line breaks matter.
Columns shifted after loading into a databaseRows in the source CSV have different numbers of fields.Fix the short or long rows in the CSV first; the CSV Formatter warns about the first one it finds.

Frequently asked questions

Is TSV better than CSV?

Neither is better in general. TSV is easier to process line by line and to paste into spreadsheets, but it cannot store tabs or line breaks inside values. CSV can store anything thanks to quoting, at the cost of needing a proper parser.

Why did my line breaks turn into spaces?

Plain TSV has no escape for a line break, so a value containing one would be read as two rows. Replacing it with a space keeps one record per line.

Can I get the file back to CSV later?

Yes, with the TSV to CSV converter. Quotes and commas come back correctly, but tabs and line breaks that were turned into spaces stay as spaces.

What happens to empty cells?

They stay empty: the row simply has two tabs next to each other, as in 1→→London. Spreadsheets and most loaders read that as an empty value in the middle column. PostgreSQL's text format treats it as an empty string, not NULL.

Should the file be .tsv or .txt?

The download is named converted.tsv. Excel's own tab-delimited export uses .txt, and many tools accept either; rename the file if the program you are loading it into asks for one or the other.

Is my file uploaded?

No. The CSV is parsed and converted in your browser and is not sent anywhere. The URL button only fetches the address you type, from your own browser.

Related tools