Command Palette

Search for a command to run...

Diff & Compare

Every Diff & Compare tool on Toolz.dev: 4 free utilities that run entirely in your browser. No signup, no uploads, no downloads.

A text diff compares two files line by line, which is the right approach for prose and source code and the wrong one for structured data. Reformat a JSON document and every line changes while nothing about the data has; sort a CSV export differently and a text diff reports the whole file as rewritten. These four tools compare structure instead, so what they report is what genuinely differs.

Use the JSON diff for API responses and config files, the CSV diff for exports and data reconciliation, the XML diff for feeds and configuration, and list compare for the simplest and most common case of all: two lists of ids, emails or SKUs and the question of what is in one and not the other.

Which diff tool for which kind of data

Which diff tool for which kind of data
DataToolHow it matches things up
API responses, configJSON DiffBy key path, so key order does not matter
Exports, spreadsheetsCSV DiffBy a key column, or by row position
Feeds, configurationXML DiffBy element structure rather than by line
Two lists of valuesList CompareSet operations: in both, in one only, union

Why a text diff fails on structured data

JSON object keys have no defined order, so two documents with identical content and different key order are equal as data and completely different as text. Add reformatting, an indentation change or a serialiser that sorts keys, and a line-based diff produces hundreds of changes describing nothing. The JSON diff walks both documents and reports changes as paths - user.roles[0].name changed from editor to admin - which is both shorter and directly actionable.

CSV has the same problem for a different reason. Rows exported in a different order are the same dataset, but a text diff pairs line 1 with line 1 and declares everything changed. Matching on a key column instead - an id, an email, a SKU - finds the row in both files and compares cell by cell, which is what turns a diff into a reconciliation. Where no stable key exists, positional matching is the fallback and its limits should be understood: an inserted row at the top shifts everything below it.

Reading a structural diff

A structural diff has four outcomes rather than two. A key or row can be added, removed, or changed in value, and a fourth case is worth watching for: changed in type, where a field that was the number 42 becomes the string "42". That last one causes real bugs and is invisible in a text diff, because the characters on the line are nearly identical. The JSON diff reports it separately for that reason.

Arrays are where every structural diff makes a judgement. An array is ordered, so an item inserted at the front shifts every index after it, and a naive comparison reports every element as changed. When you are diffing a list where order does not carry meaning, sorting both sides before comparing produces a far more useful result, and where the items are simple values, list compare answers the question directly with set operations rather than a diff at all.

What each tool is really for

These get used for reconciliation more than for review. Comparing yesterday and today exports to find which records changed. Checking a staging API response against production. Confirming that a migration produced identical output. Finding which subscribers are in the new list and not the old one, which is list compare at its most basic and one of the most common data questions there is.

The XML diff carries one XML-specific subtlety: attribute order is not significant in XML, but element order usually is, so a good comparison treats those differently rather than applying one rule. Everything here runs client-side, which for this category is the operative feature, since the files being compared are usually production exports containing exactly the data that should not be pasted into a remote service.

Frequently asked questions

Why does a normal diff show my whole JSON file as changed?
Because it compares lines, and reformatting or reordering keys changes every line without changing the data. JSON object keys have no defined order, so two documents can be identical as data and entirely different as text. A structural diff walks the parsed documents and reports only real differences, as key paths.
Does key order matter when comparing JSON?
Not to the data, and not to a structural diff. The JSON specification defines objects as unordered collections of name-value pairs, so a serialiser is free to emit keys in any order. Array order, by contrast, is significant, and a reordered array is a genuine difference.
How are rows matched when comparing two CSV files?
By a key column when you nominate one, which finds the same record in both files regardless of row order and compares it cell by cell. Without a key, rows are matched by position, which works only when both files are sorted identically, since a single inserted row shifts everything below it.
What is a type change and why does it matter?
A value keeping its content while changing its JSON type, such as 42 becoming "42" or true becoming "true". It is nearly invisible in a text diff, since the characters barely differ, and it breaks strict comparisons, arithmetic and schema validation downstream. The JSON diff reports it as its own category.
How do I find what is in one list and not the other?
Use list compare, which gives the set operations directly: values in both lists, values only in the first, values only in the second, and the de-duplicated union. It is the right tool when the items are simple values such as emails, ids or SKUs and the question is membership rather than change.
Are the files I compare uploaded anywhere?
No. All four tools parse and compare in your browser, with nothing transmitted or stored. That matters more here than in most categories, since the files people diff are usually production exports, customer lists and API responses containing real data.