CSV Diff: Compare Two CSV Files

Compare two CSV files by a key column and see which rows were added, removed or changed, down to the cell. Reordered rows and columns create no false changes. It runs in your browser and nothing is sent anywhere.

How to compare two CSV files

  1. Paste each CSV or choose a local file, up to 5 MB each. Row 1 of each file must hold the column names.
  2. Choose a key column whose values are present and unique in both files, such as an ID.
  3. Press Compare files. Editing either input or changing the key clears the result, so what you see always matches the inputs.
  4. Download the diff to keep the full result. The page shows the first 200 rows of each list, up to 1000 cell rows in all.

Worked example

Before
id,name,plan
1,Ada,pro
2,Grace,free
3,Linus,=1+1
After
plan,id,name
team,2,Grace
pro,1,Ada
free,4,Katherine

The after file has its rows and columns in a different order. With id as the key, that creates no changes. The tool reports 1 changed cell (id 2, plan from free to team), 1 removed row (id 3) and 1 added row (id 4). Id 1 is unchanged.

Exported diff
change,key,column,before,after
key-column,,id,,
summary,,beforeRows,,3
summary,,afterRows,,3
summary,,addedRows,,1
summary,,removedRows,,1
summary,,changedRows,,1
summary,,unchangedRows,,1
summary,,changedCells,,1
summary,,columnsOnlyInBefore,,0
summary,,columnsOnlyInAfter,,0
row-removed,3,id,3,
row-removed,3,name,Linus,
row-removed,3,plan,'=1+1,
row-added,4,plan,,free
row-added,4,id,,4
row-added,4,name,,Katherine
cell-changed,2,plan,free,team

What counts as a change

Cells are compared exactly, with no trimming, case folding or number parsing, so 1.0 and 1 differ. Line breaks inside a cell count too: a cell whose only difference is LF versus CRLF is a change, and the result marks each carriage return with ␍. Text boxes turn pasted line breaks into LF, so choose files instead of pasting when line break style matters. Line endings between rows never create a change.

A column found in only one file is listed as a column difference. It is not compared, so it cannot make a row count as changed. Files are rejected with a specific message for malformed quotes, empty input, repeated column names, a key column missing from a file, rows with the wrong number of cells, and missing or repeated key values.

Export format

The download is a UTF-8 CSV named csv-diff.csv with CRLF line endings, a byte order mark so Excel reads it correctly, and the header change,key,column,before,after. Each record holds one fact, in this order, and unused fields are empty:

  • key-column: The key column, in column.
  • summary: One count per record: its name in column, its value in after.
  • column-only-in-before: A column found only in the before file.
  • column-only-in-after: A column found only in the after file.
  • row-removed: One record per column of a removed row, with the value in before.
  • row-added: One record per column of an added row, with the value in after.
  • cell-changed: One changed cell, with its before and after values.

Spreadsheet safety

Spreadsheets can run a cell as a formula, so the export writes any key, column name or value starting with =, +, -, @, a tab, a carriage return or an apostrophe with a leading apostrophe. Numbers such as -5 get one too. In the example above, =1+1 is exported as '=1+1. This applies only to the export: comparison and the page use your original values. To restore a value, remove one leading apostrophe from any exported field that has one.

Frequently asked questions

How do I compare two CSV files?

Paste or choose both files, pick a key column whose values identify each row, and press Compare files. The tool lists added, removed and changed rows, the cells that changed, and any columns found in only one file.

Does row or column order matter?

No. Columns are matched by header and rows by key, so a file that is only reordered shows no data changes.

Why is a cell marked as changed when it looks the same?

Comparison is exact: spaces, letter case and line break style all count. A cell whose only difference is LF versus CRLF is a change, and the result marks each carriage return with ␍. Text boxes turn pasted line breaks into LF, so choose files instead of pasting when line break style matters.

Are my CSV files uploaded?

No. Files are read and compared in this browser tab. Your data is not sent to a server or written to the URL, analytics, logs or browser storage.

Why do some exported values start with an apostrophe?

A value starting with =, +, -, @, a tab, a carriage return or an apostrophe gets a leading apostrophe in the export, so a spreadsheet shows it as text instead of running it as a formula. The comparison itself always uses your original values.

Related