JSON & text diff checker.
Compare two JSON documents or any two texts and see exactly what changed, by line, word or character, side by side or as a unified patch. JSON mode sorts keys first so reordered objects do not show up as changes. Nothing leaves your browser.
Result
About this tool
The two inputs are split into lines, words or characters and compared with a longest common subsequence algorithm, the same idea behind diff and git diff. Lines only in the original are shown as removed, lines only in the new version as added, and the side by side view lines up changed blocks so you can read across. Unified view produces the familiar - and + layout and the Copy patch button gives you that as text. Everything runs in your browser; the text is never sent anywhere.
Options
| Option | Effect |
|---|---|
| Lines / words / characters | The unit of comparison. Lines for code and config; words for prose; characters for spotting the one byte that differs between two tokens or hashes. |
| Side by side / unified | Two columns with changes aligned, or a single patch-style column. Unified is what Copy patch produces. |
| Ignore whitespace | Collapses runs of spaces and tabs and trims line ends, which hides reformatting and indentation changes. |
| Ignore case | Treats Foo and foo as the same. |
| JSON: sort keys | Parses both sides, sorts every object's keys recursively and pretty-prints them before comparing, so two API responses that differ only in key order come out identical, and a real change in a nested value shows up on exactly one line. Invalid JSON on either side is reported rather than compared. |
JSON diff: compare two JSON documents
Tick JSON: sort keys and paste a document on each side. Both are parsed, every object's keys are sorted recursively and the result is pretty-printed one value per line before the comparison runs, so two API responses that differ only in key order come out identical and a real change to a nested value lands on exactly one line. Two consequences of going through the browser's JSON parser are worth knowing: array order is preserved, because [1, 2] and [2, 1] are different values and will show as a change; and numbers are normalised, so 1.0 and 1 compare as equal, and integers beyond 253 lose precision on both sides alike. If either side is not valid JSON the parser's error is shown instead of a diff, which is often the answer you were looking for anyway. To tidy one document before comparing, or to browse a large one, use the JSON formatter.
Uses
- Config drift: compare the same file from two environments and find the setting that differs.
- JSON diff: check an API response against the version you expected, or two versions of a fixture, without key order getting in the way.
- Formatter output: see what a formatter, minifier or linter actually changed.
- Token or hash comparison: character mode makes a single wrong digit obvious.
- Producing a patch: copy the unified diff into a ticket, a code review comment or a chat message.
Limits
Line mode handles a few thousand lines per side comfortably. Word and character modes are quadratic in the worst case and are meant for paragraphs and short strings, not whole files. For very large files, diff -u a b or git diff --no-index a b in a terminal is the right tool.