$ diff --check

text diff checker.

Compare two texts side by side. Added lines in green, removed lines in red.

original text
modified text
The tool implements a line-based LCS (Longest Common Subsequence) diff algorithm. It compares line by line and highlights additions in green and deletions in red.
The tool currently compares lines as-is. For code review, ensure consistent formatting before comparing.
Both text areas accept large inputs. Very large files may slow down the browser since all processing happens client-side.

How Diff Algorithms Work

Text diffing finds the minimum set of changes (insertions, deletions) to transform one string into another. Different algorithms optimize for different goals:

Algorithm Comparison

AlgorithmTimeOutput QualityUsed By
MyersO(n*m)Good (minimal edits)Git, most diff tools
PatienceO(n*m)Better for codeGit (--diff-algorithm=patience)
LCSO(n*m)Optimal but slowTextbooks, small inputs
HistogramO(n*m)Best for codeGit default (2.9+)

Line-Level vs Word-Level vs Char-Level

Line diff:   shows whole lines changed
Word diff:   shows which words within a line changed
Char diff:   shows individual character changes (most granular)

// Example — char-level diff of "color" → "colour":
// co- -l +ou- r

Code review tip: Use word-level or char-level diffing for long lines (minified code, single-line configs). Line-level diffing on a 500-char line just shows the whole line as changed.

learn more in our detailed guide.

→ read the guide