Usage
Paste two versions of the same text: the comparison shows up line by line, with line numbers on each side. Added lines appear in green, removed ones in red, unchanged ones stay neutral.
Handy for comparing two API responses, two config files, or two drafts of the same paragraph — without going through a Git repository.
How the comparison is computed
The tool relies on the longest common subsequence (LCS), the same principle
as git diff. The idea: find the largest set of lines present in both texts, in
the same order. Everything left over is an addition or a removal.
That is why a line that was merely moved shows up as a removal then an addition: LCS reasons about sequences, not about moves.
Line endings are normalised: a CRLF (Windows) text and the same text in LF
(Unix) are not reported as different.
A deliberate limit
The LCS table takes space proportional to the product of both lengths. For two 2,000-line texts that is already four million cells. Beyond that size the tool declines the comparison rather than freezing your tab.
Comparing two files on the command line
# classic comparison, unified format
diff -u old.txt new.txt
# ignoring whitespace
diff -u -w old.txt new.txt
# with git's colouring, outside any repository
git diff --no-index old.txt new.txtComparing two objects in JavaScript
For data structures rather than text, comparing normalised JSON avoids false positives caused by key ordering:
const normalize = (value) =>
JSON.stringify(value, Object.keys(value).sort(), 2);
const identical = normalize(a) === normalize(b);