How the Diff Algorithm Works
This tool uses the Longest Common Subsequence (LCS) algorithm to compute the minimal set of differences between two texts. The LCS approach finds the longest sequence of lines that appear in both inputs in the same order, then marks everything else as added or removed. This produces the cleanest possible diff with the fewest change markers. For inline character-level differences within a changed line, a second LCS pass runs on the characters of each changed line pair — highlighting exactly which characters differ, not just the whole line.