Text Diff Checker
TextCompare two texts and see added, removed, and unchanged lines highlighted instantly. Line-by-line diff in unified format. In-browser, no data stored.
What is a Diff?
A text diff formatter compares two versions of a text โ original and modified โ and produces a line-by-line difference report showing exactly what changed. Lines prefixed with + are new additions in the modified version; lines with - were present in the original but removed; and unchanged lines are shown with a two-space prefix for context.
This format, called a unified diff, is the foundation of version control. It is how git diff, svn diff, and the Unix diff command display changes between file versions. Understanding the diff format lets you quickly answer questions like: "What exactly did this edit change?", "Did the reviewer's feedback introduce any new content?", or "Is this version of the document the same as what we approved last week?"
The formatter uses the Longest Common Subsequence (LCS) algorithm โ the same algorithm underlying most diff tools โ to find the largest set of lines that appear in both texts in the same relative order. Everything not in that common set is a change: a deletion from the original or an addition in the modified version. The result is a precise, unambiguous account of every line that moved.
This is useful for comparing contract versions, comparing two drafts of a document, checking whether a configuration file was changed correctly, or reviewing a colleague's edit to a shared document. Use it alongside the Text to Slug Formatter when reviewing URL changes, or the CSV Cleaner Formatter when comparing data exports.
How to use this Diff calculator
- Paste the original (older) version of your text into the Original Text field.
- Paste the modified (newer) version into the Modified Text field.
- Enable Ignore Case if you want to treat letter-case differences as equal.
- Enable Ignore Trailing Whitespace to suppress whitespace-only line differences.
- Read the header to get the overall change count, then scan the diff body for
+and-lines. - Lines with two-space prefixes are unchanged context lines.
Formula & Methodology
The formatter uses a dynamic-programming LCS implementation: Given original linesA[1..m]and modified linesB[1..n], a tabledp[i][j]stores the length of the longest common subsequence ofA[1..i]andB[1..j]:dp[i][j] = dp[i-1][j-1] + 1 if A[i] == B[j] dp[i][j] = max(dp[i-1][j], dp[i][j-1]) otherwiseThe diff is reconstructed by tracing back through the dp table: - IfA[i] == B[j]: line is unchanged (prefix) - Ifdp[i][j-1] >= dp[i-1][j]: line is an addition (prefix+) - Otherwise: line is a deletion (prefix-) Memory: O(m ร n). Time: O(m ร n). Maximum supported: 2,000 ร 2,000 lines. Before/after example: Original:The quick brown fox jumps over the lazy dogModified:The quick brown fox leaps over the lazy catDiff output:--- original (2 lines) +++ modified (2 lines) @@ -2 lines +2 lines; 1 added, 1 removed @@ The quick brown fox - jumps over the lazy dog + leaps over the lazy cat
Frequently Asked Questions