Skip to content

Free · Browser-local tools

Compare CSV files

Compare two CSV files by a unique key column. Review added, removed, and changed records, then download a CSV report.

Compare CSV

Compare two versions of your CSV

Open your file in the CSV editor with this tool already selected. Preview the result before downloading.

  1. Choose updated, then original CSV.
  2. Select a complete unique key column.
  3. Review added, removed and changed values, then download the full report.

Free · No signup · File contents stay in your browser. Open files up to 1 GiB with browser storage.

Try a small example

3 records · 3 columns
Illustrative CSV sample data
idnameamount
1Example one12
2Example two24
3Example three18

Example difference

Key id=2 · amount: 24 → 30

Open the sample to try the tool with an updated comparison file included.

How to compare csv

  1. 1

    Choose updated, then original CSV.

  2. 2

    Select a complete unique key column.

  3. 3

    Review added, removed and changed values, then download the full report.

What to expect

Files need identical ordered headers and unique nonblank keys. Structured differences retain exact source values and column context; original tables remain intact.

Local files and clear limits

These tools process file contents on your device. The browser workspace accepts files up to 1 GiB and 5 million records, subject to available browser storage and decoded-record limits. This tool's calculations support up to 100,000 records, 2 million cells and 64 MB of text. Download a new copy to keep your result.

Plain answers

Compare CSV questions

What do the comparison files and key columns need?

Files need identical ordered headers and unique nonblank keys. Structured differences retain exact source values and column context; original tables remain intact.

Does my CSV leave my device?

File selection, editing and these task operations run in your browser. Optional recipe assistance, when available, sends your goal and only the column metadata or sample values you explicitly include to its configured provider. Your file is not attached automatically; see Privacy for processing details. Manual editing requires no account or file upload. Download a new copy to keep your result; refreshing restores the original input, not unsaved edits.

Do the editor and task have the same file limits?

The editor opens files up to 1 GiB and 5 million records, subject to browser storage and decoded-record limits. This task supports up to 100,000 records, 2 million cells and 64 MB of decoded text.

Other ways to work with your CSV

Use these local examples when you prefer a script or SQL. They create separate results and explain where their behavior differs from this browser tool.

Compare CSV versions by an exact key with Python

Writes added, removed and changed records to comparison.json without modifying either input. Change id only when you have another complete unique key.

Before you start

  • Python 3.10 or later. Run in a working folder with a backup of your source; output files may be replaced unless opened in exclusive mode.
  • Place original.csv and updated.csv in that folder. Examples use UTF-8, a comma delimiter and a header row. Column-specific recipes use id,label,amount,status,note; adapt names to your file.
Run the complete Python example
python3 - <<'PY'
import csv
import json

def load(path):
    with open(path, encoding="utf-8-sig", newline="") as source:
        table = list(csv.reader(source, strict=True))
    headers, rows = table[0], table[1:]
    if len(set(headers)) != len(headers) or any(len(row) != len(headers) for row in rows):
        raise ValueError("Expected unique headers and rectangular records")
    column = headers.index("id")
    keys = [row[column] for row in rows]
    if any(not key for key in keys) or len(set(keys)) != len(keys):
        raise ValueError("id must be unique and nonblank")
    return headers, dict(zip(keys, rows))

headers, original = load("original.csv")
updated_headers, updated = load("updated.csv")
if headers != updated_headers:
    raise ValueError("Header names and order must match")
report = {
    "added": [row for key, row in updated.items() if key not in original],
    "removed": [row for key, row in original.items() if key not in updated],
    "changed": [{"id": key, "before": original[key], "after": row}
                for key, row in updated.items() if key in original and original[key] != row],
    "columns": headers,
}
with open("comparison.json", "w", encoding="utf-8") as target:
    json.dump(report, target, ensure_ascii=False, indent=2)
print("Wrote comparison.json")
PY

Limits and output

  • CSV has no stored type schema. Python keeps fields as strings until an example explicitly converts a value. These recipes do not add spreadsheet formula protection; import sensitive-looking strings as text in spreadsheets.
  • This recipe retains the parsed table in memory; use a streaming approach for files that do not fit.

Documentation: Python CSV reader and writer

Open-source CSV Compare

Compare CSV files by key from the command line or use the library in your own scripts.