Text Diff

Compare two texts line by line. Added lines are highlighted in green, removed lines in red. Line numbers are now included for better tracking.






How This Converter Works

Compares two texts line by line using a longest-common-subsequence (LCS) diff. Case-sensitive and ignore-whitespace options are off by default; ignored whitespace is collapsed and trimmed before line comparison.

Formula or rule

Split both inputs on LF; compute an LCS dynamic-programming table over normalized lines; backtrack to mark same, added, and removed lines.

Example

Input
Original: cat\nx; modified: cat\ny
Calculation
The LCS is cat; x is removed from the original and y is added in the modified text.
Result
cat\n- x\n+ y