fjordtools / Text / Text Diff

Text Diff: Compare Two Texts or JSON

Compare two texts or JSON documents and see added and removed lines. Ignore whitespace or case, and copy a unified patch. Runs in your browser.

Original
Changed
Differences
About Text Diffhow it works and good to know

How the comparison works

Both texts are split into lines and compared with the Myers algorithm, the same shortest-edit-script method behind git diff. Removed lines are marked in red, added lines in green, and by default only the changes and the three lines around them are shown.

Ignoring noise

"Ignore spaces" treats lines that differ only in leading, trailing or repeated whitespace as equal. "Ignore case" does the same for capitalisation. Line endings (CRLF or LF) never count as a difference.

Comparing JSON

Switch on JSON to parse both sides, sort the keys and format them identically before comparing, so a reordered or minified document with the same data shows no difference. If a side is not valid JSON you get the line and column of the problem.

Copy as patch

The button copies the changes in unified diff format (@@ -3,5 +3,5 @@ hunks with three lines of context), ready to paste into a review or a ticket.

Privacy

The comparison runs in your browser. Neither text is uploaded or stored.

Related tools