Text Diff Comparison
Compare two blocks of text, source code, configuration files, or JSON payloads side-by-side or in unified diff view 100% locally in your browser. Highlights exact added, removed, and modified lines alongside inline word/character-level changes and exports standard Git-compatible unified diff patches.
Lines A [1..N], Lines B [1..M] ──► Trim Common Prefix & Suffix in O(min(N, M))
──► Compute LCS Matrix DP[i][j] = (A[i] == B[j]) ? DP[i+1][j+1] + 1 : max(DP[i+1][j], DP[i][j+1])
──► Backtrack Edit Graph + Pair Adjacent Remove/Add Blocks for Word-Level Inline Diff Parameters
- LCS (DP Matrix)
- Finds the maximal sequence of unchanged lines so minimal additions (+) and deletions (-) are reported
- @@ -l,s +l,s @@
- Standard GNU/Git unified diff hunk header indicating starting line numbers and line spans
- Inline Tokenization
- Splits modified lines on word and punctuation boundaries (`/(\s+|\b)/`) to highlight exact character edits