Compare Two TSV Files
A line-based diff on a data file tells you a row changed but not which field, and reports every row as changed the moment the sort order shifts. This compares the two files as tables instead: name a key column and rows are matched by identity, so you get added, removed, and changed — column X went from A to B. Leave the key blank and it compares whole rows as a multiset, ignoring order entirely.
How to use
- Put the old file in A and the new one in B. The report is phrased as changes going from A to B.
- Name a key column — the field that identifies a record, like
idorsku. Comma-separate for a composite key:user_id,date. - Read the header block first: it reports both column lists and whether they match, which is usually the real explanation for a surprising diff.
- Copy the report if you need to paste it into a ticket or a review.
Reading the report
+ marks a row present only in B, - a row present only in A, and ~ a row whose key exists in both but whose cells differ — followed by one indented line per changed field showing the old and new value. With no key column, only + and - appear, because without identity there is no such thing as a changed row: a modified row simply reads as one removal plus one addition.
When the headers differ, columns are matched by name rather than by position, so a file where someone inserted a column in the middle still diffs cleanly. Columns that exist on only one side are skipped in the cell comparison — the header block is where you find out about them.
When to use which mode
Key-aligned is what you want for anything with a primary key: comparing yesterday's export to today's, verifying a migration, checking that a transformation only touched the fields it was supposed to.
Whole-row mode suits files with no natural key — event logs, coordinate lists, word lists. It's a multiset comparison, so duplicates are counted: if A has a row twice and B has it once, you get one removal. Order is irrelevant, which makes it the right check for "did this pipeline change reorder my data or actually change it?"
FAQ
Why does every row show as changed?
Usually invisible whitespace or line endings. A file saved on Windows carries \r at the end of the last field on every row, which makes every last-column value differ. Run both files through normalize line endings and diff again. The other common cause is one file having a BOM — see add or remove BOM.
What if key values aren't unique?
The last row wins on the B side and each A row is compared against it, which produces a confusing report. Check first with value counts on the key column, or use a composite key that is unique.
Is the report capped?
No — every difference is listed. On two large and very different files that means a very long report; a narrower comparison (extract the columns you care about with extract columns first) is usually more readable than scrolling it.
Can I diff a TSV against a CSV?
Convert the CSV first with CSV → TSV, then paste both sides here. Comparing across formats directly would mean guessing at delimiters, which is exactly the guessing this site avoids.
Privacy
100% client-side. Neither file is uploaded. See the privacy policy.