How to use the online diff checker
- Paste the original text on the left and the new version on the right, or use Open file or drag and drop to compare files. Files are read locally and never uploaded.
- Read the summary: how many lines were added, removed, changed and left unchanged.
- Choose Side by side to see both versions in two columns or Unified for a single column with
-and+markers, likegit diff. - Turn on Only changed lines to fold long unchanged parts, and use Swap to reverse the direction.
Line diff and word diff
The comparison works in two passes. First the texts are split into lines and compared as sequences, which finds whole lines that were inserted or deleted. Where a deleted line and an inserted line sit at the same spot, they are treated as one changed line and compared again, word by word, so a single corrected typo is highlighted instead of the whole line.
The quick brown fox
- jumps over the lazy dog.
+ leaps over the lazy dog.
Pack my box with
five dozen liquor jugs.
+ Sphinx of black quartz, judge my vow.
How vexingly quick daft zebras jump!The line matching uses the algorithm from Eugene Myers' paper “An O(ND) Difference Algorithm and Its Variations” (1986). It always finds a shortest edit script, so the diff shows the fewest possible changes. For two very different texts with thousands of edits, the tool falls back to marking the changed block as a whole to keep your browser responsive.
Ignore whitespace and case
Not every difference is meaningful. Re-indented code, trailing spaces or a switch from tabs to spaces can make a text difference checker light up every line. Ignore whitespace treats any run of spaces and tabs as one space and ignores spaces at the start and end of a line. Ignore case treats “Hello” and “hello” as equal. Windows (CRLF) and Unix (LF) line endings are always treated as the same, so a file saved on another system does not show as entirely changed.
Compare code, JSON and other files
Any plain text works, which makes this a quick code compare online for snippets, SQL queries or config files. For structured data, normalise both sides first so formatting differences do not hide real ones: run JSON through the JSON formatter with Sort keys on, or XML through the XML formatter, then compare the results. To find a pattern rather than a difference, use the regex tester.
For files under version control, git diff or git diff --word-diff gives the same kind of output in a terminal. This page is handy when the two versions are not in a repository, such as text from an email, two exports or a document someone sent back with edits.