TSV’s only formal definition is the IANA registration of the media type
text/tab-separated-values, whose contact is the University of Minnesota
Internet Gopher Team (registrant Paul Lindner); the registration carries no date. This
page follows the
IANA
registration, the
PostgreSQL
COPY documentation, the
MySQL
LOAD DATA documentation, the
Python csv module
documentation and the W3C
Model for Tabular Data and Metadata
on the Web, read 2026-11-12.
The registered rules
- Each record is a single line; fields are separated by a tab character.
- The first line is special: it holds the name of each field, separated by tabs.
- Each record must have the same number of fields.
- Fields that contain tabs are “not allowable”. The registration defines no quoting or escaping.
- Required parameters are given as “Character Set, Encoding Type”; optional parameters as “None”.
The registration’s own grammar, as written there:
field ::= [character]+ # multiple characters
name ::= [character]+
nameline ::= name [TAB name]+ EOL
record ::= field [TAB field]+ EOL # at least one field, or more
tsv ::= nameline record+
Read literally, [TAB name]+ needs at least two fields, although the
comment says “at least one field”. The registration does not define
EOL or character.
Conventions in practice
| Convention | Used by | Rule |
|---|---|---|
| CSV-style quoting | Python’s csv module, whose excel-tab dialect “defines the usual properties of an Excel-generated TAB-delimited file” | With the default QUOTE_MINIMAL, fields containing the delimiter, the quote character, \r or \n are quoted, and quotes inside are doubled, as in CSV. |
| Backslash escapes | PostgreSQL COPY text format (tab is its default delimiter) | Backslash, newline, carriage return and the delimiter must be preceded by a backslash in a value. COPY FROM reads \b, \f, \n, \r, \t, \v, octal \digits and hex \xdigits; null is \N by default; a line holding only \. marks end of data. |
| Backslash escapes | MySQL LOAD DATA (defaults FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n') | \0 NUL, \b backspace, \n line feed, \r carriage return, \t tab, \Z Control+Z, \N null. |
PostgreSQL’s COPY TO ends rows with LF (CR LF only for a server file on
Windows), and COPY FROM accepts LF, CR or CR LF but complains if they are
mixed. The W3C model records that data copied from Excel for Mac 2011 is
tab-delimited with LF line breaks.