How this tool works
The two texts are split into tokens — lines, words or single characters — and compared by finding the longest sequence that appears in both, in the same order. Everything outside that sequence is an addition or a removal. This is how version-control tools compare files, and it is what makes the result readable: matching blocks stay put instead of every line after an inserted one being reported as changed.
Matching runs at the start and end of both texts are recognised and set aside before the comparison table is built, which on real documents removes most of the work, since edits are usually confined to part of a file. Ignoring case or surrounding whitespace changes what counts as a match; the text shown to you is always the original, so an ignored difference simply stops being highlighted rather than being rewritten.
Reading the comparison
- An edited line is a removal plus an addition: at line granularity there is no concept of a modified line — the old one goes and the new one arrives. Switch to word granularity to see what actually changed inside it.
- The counts are tokens, not edits: at word granularity a rewritten sentence can report a dozen additions. Compare the counts between runs rather than reading them as a number of changes.
- Granularity is the main setting: lines for code and structured text, words for prose, characters for short strings where you are hunting a single wrong digit.
- Character granularity is the expensive one: the comparison cost grows with the product of the two lengths, so a long document compared character by character will take noticeably longer than the same document compared by line.