User Rating 0.0
Total Usage 0 times
Is this tool helpful?

Your feedback helps us improve.

About

Miscounting rows in a TSV file before a database import leads to silent data loss. A trailing newline adds a phantom row. An embedded line break inside a quoted field splits one record into two. This tool parses raw TSV text and reports the exact count of total lines, non-empty data rows, and detected columns from the first record. It distinguishes between blank lines (matching ^\s*$) and actual data, so you know precisely what your import script will consume. The count assumes standard TSV conventions: no quoting, no escaped tabs, one record per line.

tsv row counter tab separated values line count tsv analyzer data rows

Formulas

The row count is computed by splitting the input on newline characters and applying optional filters:

Rtotal = split(input, \n).length
Rdata = Rtotal Rempty Rheader

Where Rempty counts lines matching the regular expression ^\s*$ (zero or more whitespace characters). Rheader is 1 if the user opts to exclude a header row, 0 otherwise. Column count C is derived from the first non-empty line: C = split(line0, \t).length. A trailing newline produces one additional empty string after the final split. The tool detects and discards this phantom entry to avoid off-by-one errors.

Reference Data

FormatDelimiterTypical ExtensionQuoting ConventionMax Columns (Practical)Line EndingEncodingHeader RowEmpty FieldCommon Use
TSVTab (\t, U+0009).tsv, .txtNone (fields must not contain tabs)UnlimitedLF or CRLFUTF-8OptionalAdjacent tabsBioinformatics, spreadsheets
CSVComma (,).csvDouble-quote RFC 4180UnlimitedCRLF (RFC)UTF-8 / Latin-1OptionalAdjacent commasGeneral data exchange
SSVSemicolon (;).csv (locale)Double-quoteUnlimitedCRLFUTF-8OptionalAdjacent semicolonsEuropean Excel exports
PSVPipe (|).txt, .psvRareUnlimitedLF or CRLFUTF-8OptionalAdjacent pipesLegacy mainframe data
Fixed-WidthColumn positions.txt, .datNoneDefined by specLF or CRLFASCII / EBCDICOptionalSpacesGovernment filings
JSON LinesNewline per object.jsonlJSON stringsN/A (key-value)LFUTF-8N/ANULLLog streaming
ParquetBinary columnar.parquetN/AUnlimitedN/ABinarySchemaNull bitmapBig data / analytics
Excel XLSXXML cells.xlsxN/A16384N/AUTF-8 XMLOptionalEmpty cell elementBusiness reporting
IANA TSVTab (IANA registered).tsvNone (strict)UnlimitedLF (IANA rec.)UTF-8Required (IANA)Adjacent tabsStandards-compliant exchange
W3C WebVTTTab (cue fields).vttNone3LF or CRLFUTF-8Signature lineEmpty cueVideo subtitles
BED FormatTab.bedNone12 (standard)LFASCIINone (track lines)Period (.)Genomic intervals
VCFTab.vcfNone8 + samplesLFUTF-8Meta + headerPeriod (.)Variant calling
GFF3Tab.gff3URL-encoded9LFUTF-8Directive linesPeriod (.)Gene annotation
SAMTab.samNone11 + optionalLFASCII@-prefixed headersAsterisk (*)Sequence alignment

Frequently Asked Questions

A file ending with a newline character (\n) produces an empty string as the last element when split. This tool detects trailing newlines and excludes the resulting phantom empty row from the total count, preventing the common off-by-one error that plagues naive line-counting approaches.
Yes. Before counting, all carriage-return/line-feed sequences (\r\n) are normalized to \n. Standalone \r characters (old Mac format) are also converted. This ensures consistent counts regardless of the originating operating system.
Standard TSV does not support embedded newlines within fields - unlike CSV with RFC 4180 quoting. If your data contains embedded newlines, each fragment will be counted as a separate row. Pre-process such data by removing or escaping embedded newlines before counting.
Both are classified as empty. The filter uses the pattern ^\s*$ which matches lines containing zero or more whitespace characters (spaces, tabs). When "Skip empty lines" is enabled, all such lines are excluded from the data row count.
The tool processes text in-browser using JavaScript string operations. Files up to approximately 50 MB work reliably in modern browsers. For files exceeding this, consider using command-line tools like wc -l on Unix systems. The tool provides a file size indicator after upload so you can gauge feasibility.
Column count is derived from the first non-empty line by splitting on tab characters (U+0009). If your file uses spaces, commas, or other delimiters instead of tabs, the entire line registers as a single column. Verify your delimiter is a genuine tab character, not multiple spaces.