csvkit.org
CSV (Comma-Separated Values) utilities, in the browser
Say hi →

CSV Diff

updated 30 August 2026

compare two csvs
Left (old) CSV
Drop left file, or
Right (new) CSV
Drop right file, or
ready

CSV Diff Toolkit

Compare two versions of a CSV at the row and cell level. Drop in the old and new files and it picks the key column itself — the columns both files share appear as chips under the bar, with the one it chose marked, so changing it is a click rather than a guess at a name. The result is an added / removed / changed breakdown with cell-level highlighting. More useful than plain diff for tabular data, which flags reordered rows as different and cannot point at the cell that changed — the typical use is sanity-checking a data migration before cutover.

Before you start

You need:

The two files don't have to have the same columns or the same row order. The diff matches rows by key, then compares cells of the matched rows.

How to use it

  1. Paste or drop your old CSV into the left pane.
  2. Paste or drop your new CSV into the right pane.
  3. Check the key. The chips under the bar are the columns both files have; the dashed one is what the tool picked. Click another to switch, click a second to make it a composite key (country + sku), or click whole row to compare everything.
  4. The result updates as you paste. Compare re-runs it if you want.
  5. Review the result below the panes. Colour legend:
    • green — row exists only in the new file (added).
    • red — row exists only in the old file (removed).
    • yellow — row exists in both, but at least one cell differs. The specific differing cells are highlighted.
  6. Click Download diff for a CSV with a change_type column.

How the key is chosen

A column can be a key if it appears in both files, is never blank, and never repeats — that is exactly the property that lets a row in one file be matched with a row in the other. Chips for columns that fail the test are dimmed, and hovering one says why.

One exception, deliberately: a column named like an identifier (id, customer_id, sku, email…) is chosen even when it repeats, as long as it is never blank. A repeating id is a problem in the data, and matching on some other column that happens to be unique would hide it behind a diff that looks fine. The status line says how many duplicate keys there were and which side they were on.

Click whole row to compare entire rows as a set instead. That is the right choice when a file has no stable identifier, but it is weaker: a single changed cell reads as a delete plus an add, and there is no cell-level highlight.

What "changed" really means

Example

Old CSV:

id,name,city
1,Alice,Berlin
2,Bob,Paris
3,Carol,Rome

New CSV:

id,name,city
1,Alice,Berlin
2,Bob,Lyon
4,Dana,Madrid

Diff on id:

Tips & common pitfalls

Troubleshooting

Every row shows up as changed.

Most likely the files have different line endings or an encoding mismatch, or the key column has a subtle difference (BOM, trailing space). Open both files in a plain editor and compare the first row byte-for-byte.

Rows I expect to match are flagged as "added + removed".

Your key isn't actually unique, or its values don't match exactly across files. Try a composite key or normalise the key column first (trim, lowercase).

The tool says "duplicate key" but I only have one row with that id.

Check for whitespace or invisible characters in the key cell. Two rows with keys "42" and "42 " collide after trimming.

Frequently asked questions

Why not just use diff?

Command-line diff does byte-level line comparison. It gets confused by reordered rows or different line endings, and it can't tell you which cell changed in a row. This tool understands keys and cells.

Can I diff on a composite key?

Yes. Enter comma-separated column names, e.g. country, sku. Rows match when the full tuple matches.

Is my data uploaded?

No. Both files stay in your browser. See the privacy policy.

Can I export only the changed rows?

Yes — Download diff exports all rows with a change_type column (added / removed / changed / unchanged). Filter that column in any spreadsheet or with awk.