Diff Checker
Compare two texts side by side with line-level highlighting.
| 1 | { | 1 | { |
| 2 | "name": "toolkit", | 2 | "name": "toolkit", |
| 3 | "version": "1.0.0", | 3 | "version": "1.1.0", |
| 4 | "private": true, | 4 | "private": true, |
| 5 | "scripts": { | 5 | "scripts": { |
| 6 | "dev": "next dev", | 6 | "dev": "next dev --turbo", |
| 7 | "build": "next build" | 7 | "build": "next build", |
| 8 | "lint": "eslint" | ||
| 8 | }, | 9 | }, |
| 9 | "license": "MIT" | 10 | "license": "MIT" |
| 10 | } | 11 | } |
About this tool
Put two versions side by side and see exactly what changed, line by line, with additions and removals colour-coded. Far quicker than reading a prose description of the differences, and whitespace-only changes can be ignored when they are just noise.
How to use it
- Paste the original on the left and the new version on the right.
- Toggle whitespace and case sensitivity if needed.
- Read the highlighted result, or switch to a unified view.
How line diffing works
The algorithm underneath is a longest common subsequence search — it finds the largest set of lines appearing in both versions in the same order, and everything else is an addition or a removal.
That framing explains some behaviour that otherwise looks wrong:
A moved block shows as a deletion plus an addition. Line diffing has no concept of "moved". A function relocated from the top of a file to the bottom appears twice, once in each colour.
Changing one character marks the whole line changed. Line-level granularity is the unit. A line is either the same or not.
Reformatting looks like a total rewrite. Re-indenting a file changes every line. Switch on "Ignore whitespace" to compare content rather than layout — that is exactly what it is for.
Removals and additions that sit adjacent are paired onto the same row here, so a modified line shows old and new side by side rather than as two unrelated entries.
Comparing code, config and data
Anything plain text works, but a little preparation makes the result far more readable.
JSON. Two documents can be semantically identical and textually different — key order and indentation vary by serialiser. Format both with the JSON formatter and sort keys first; the diff then shows only real changes.
CSV. Sort both files by the same key column before comparing, or a single inserted row will offset everything after it and mark the whole file changed.
Minified code. A minified file is one long line, so a line diff tells you nothing. Format it first.
Log files. Timestamps differ on every line, which drowns the signal. Strip them first with a regex, then compare.
Everything runs in your browser, so contracts, credentials and unreleased code are safe to paste.
Frequently asked questions
- Is there a size limit?
- No hard limit, though comparing two very large documents takes longer since the diff is computed in your browser. A few thousand lines is comfortable.
- Can I diff code?
- Yes — any plain text works, including code, JSON, CSV and logs. The comparison is line-based, so structural changes show up clearly.
- Is it safe to compare confidential documents?
- Yes. Both versions are compared in your browser, so contracts, source code and internal documents are never uploaded.