Diff Viewer (Text & JSON)
Compare two blocks of text or JSON and see a line-by-line diff with additions in green and removals in red. JSON mode ignores formatting differences. Runs in your browser.
Diff +2 โ2
โthe quick brown fox+the quick red foxjumps overโthe lazy dog+the lazy cat
About this tool
A diff shows exactly what changed between two versions of something, and this viewer computes one line by line using a longest-common-subsequence algorithm โ the same approach behind git and most code-review tools โ so it finds the minimal set of additions and removals rather than naively flagging everything after the first difference. Added lines are highlighted green, removed lines red, and unchanged lines are shown for context, with a running count of insertions and deletions. The JSON mode normalizes both sides by parsing and re-serializing them with consistent formatting before diffing, so cosmetic differences (key spacing, indentation, minified versus pretty) disappear and you see only the meaningful data changes. Use it to compare two API responses, review a config change, or check what an edit actually altered. Everything runs locally in your browser, so the content you compare is never uploaded.
How to use it
- Paste the original on the left and the changed version on the right.
- Choose Text mode, or JSON mode to ignore formatting differences.
- Read the diff: green is added, red is removed, plain is unchanged.
- Check the +added / โremoved counts for a quick summary.
Frequently asked questions
- How does the diff algorithm work?
- It computes the longest common subsequence of the two inputs' lines, then walks that result to mark each line as unchanged, added, or removed. This produces the minimal, intuitive diff โ the same technique version-control tools use โ instead of misaligning everything after one change.
- What does JSON mode do differently?
- It parses both sides and re-serializes them with identical 2-space formatting before diffing. That way differences in whitespace, indentation, or minification do not appear as changes โ only actual differences in keys and values do. Both sides must be valid JSON.
- Does JSON mode ignore key order?
- No โ it normalizes formatting but preserves key order as written, so reordering keys will still show as a difference. To compare regardless of order, sort keys consistently in both inputs first.
- Is this a line diff or a character diff?
- A line diff: it compares whole lines and marks each as added or removed. A single changed word shows as one removed line and one added line. Line diffs are the standard for code and config review and keep the output readable.
- How large an input can it handle?
- The algorithm uses memory proportional to the product of the two line counts, so it is best for typical files and payloads. Extremely large inputs (tens of thousands of lines each) may be slow; trim to the relevant section for those.
- Is my content uploaded?
- No. The comparison runs entirely in your browser with no network request, so sensitive text or payloads stay on your device.