websystemer / 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.
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
- JSON FormatterFormat, validate, minify and sort JSON.
- Regex TesterTest JavaScript regular expressions with live match highlighting.
- Base64Encode and decode text, with URL-safe and UTF-8 support.
- URL EncoderPercent-encode, decode and take apart URLs and query strings.
- JWT DecoderRead the header, payload and expiry of a JSON Web Token.
- Timestamp ConverterUnix time to dates and back, in any time zone.