W3docs

Tools

Compare Two CSV Files

Paste or drop two CSV files and match their rows by a key column. See which rows were added, removed or changed, cell by cell, whatever the row and column order. Your data stays in your browser.

Your files stay on your device: the comparison runs in your browser and nothing is uploaded.

5 rows · 5 columns · comma (detected)

5 rows · 6 columns · comma (detected)

Header detected
Match rows bySuggested. Click a column to match by it instead, then click more to combine them.

Only in file B: "country" (not compared)

Rows that differ between file A and file B
StatusLineidnameemailplanseatscountryonly in B
AddedB 6106Barbara Liskovbarbara@example.comFree1US
RemovedA 5104Edsger Dijkstraedsger@example.comPro3n/a
ChangedA 4B 2103Grace Hoppergrace@example.comOld value: TeamNew value: EnterpriseOld value: 12New value: 40US
ChangedA 3B 4102Alan Turingalan@example.comOld value: FreeNew value: Pro1UK

How the CSV comparison works

A line-by-line diff falls apart on CSV files: sort the rows differently or move a column and every line looks changed. This tool compares two CSV files the way a database would. It matches rows by a key column, such as id, email or sku, and matches columns by their header name. Row order and column order never create a difference.

File A is the original and file B is the new version. A row whose key is only in B is added, a row whose key is only in A is removed, and a row whose key is in both with at least one different cell is changed. Changed cells show the old value struck through above the new one. Columns that exist in only one file are listed but never counted as changes.

Values are compared as exact text. 1, 01 and 1.0 are different, and so are Paris and paris or a value with a trailing space. If a key appears on more than one row in a file, the tool warns you, names the key and the number of rows, and compares only the first of them.

The parser follows RFC 4180: quoted fields can hold the delimiter, doubled quotes and line breaks, and CRLF, LF and CR line endings all work. The delimiter (comma, semicolon, tab or pipe) and the header row are detected, and you can override both. Opened files are decoded as UTF-8, UTF-16 or Windows-1252. Everything runs in your browser, and large files are processed in a background worker so the page stays responsive.

Worked example

Two exports of the same customer table. File B has its columns in a different order, an extra country column and its rows shuffled. Matching by id:

File A (original)csv
id,name,plan
101,Ada,Pro
102,Alan,Free
104,Edsger,Pro
File B (new version)csv
plan,id,name,country
Pro,102,Alan,UK
Free,106,Barbara,US
Pro,101,Ada,UK
Resulttext
Added      id 106  (Barbara, Free)
Removed    id 104  (Edsger, Pro)
Changed    id 102  plan: Free → Pro
Unchanged  id 101
Only in B  country (not compared)

The exported CSV has a diff_status column (added, removed, changed (old), changed (new)), a diff_changed_columns column and every data column, quoted so it opens cleanly in Excel or Google Sheets.

Frequently asked questions

How do I compare two CSV files and find the differences?

Paste or drop both files, check that the key column (the one that identifies a row, such as id) is selected, and read the added, removed and changed counts. Click a count to list only those rows, then download the result as CSV.

What if my rows have no single unique column?

Select several key columns. They form a composite key, so user + date matches a row only when both values match.

Does the order of rows or columns matter?

No. Rows are matched by key and columns by header name. Without a header row, columns are matched by position (column 1, column 2…).

What happens with duplicate keys?

The tool shows a warning naming each duplicated key, the file and how many rows share it. Only the first row with that key is compared, so fix or deduplicate the data if the later rows matter.

Are my CSV files uploaded anywhere?

No. Parsing and comparison run entirely in your browser, and the files never leave your device.

My file uses semicolons. Will it work?

Yes. Semicolons (common in European Excel exports), tabs and pipes are detected automatically, and you can pick the delimiter yourself if the guess is wrong.