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.
Reviewed by the thecalcu.com team ยท Last updated July 4, 2026
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.
Why Use a Text Diff Formatter?
Reading two versions of a document side by side and spotting every difference is hard for humans. Subtle edits, a word swapped, a sentence reordered, a number changed from 12 to 21, are easy to miss visually. The diff algorithm never misses them.
The Ignore Case and Ignore Trailing Whitespace options prevent meaningless noise. A document exported from two different word processors may have different trailing whitespace; case changes in headings are often intentional reformatting rather than content changes. Enabling these options keeps the diff focused on substantive differences.
Who Should Use This Formatter?
Writers and editors comparing two drafts of a document can see every word-level change (at the line level) at a glance, without reading both documents from start to finish.
Developers reviewing configuration changes can paste the old and new version of a .env, nginx.conf, or docker-compose.yml file to confirm only the intended keys were changed.
Legal and compliance teams comparing contract revisions need to identify every line that differs between versions. The diff output is an unambiguous record of changes.
QA engineers comparing test output from two runs of the same test suite can quickly identify which assertions changed between runs.
Students comparing their work against a reference solution can see exactly which lines they got wrong or which extra lines they added unnecessarily.
What Insights Does the Text Diff Formatter Give You?
The header summary, @@ -N lines +M lines; X added, Y removed @@, tells you the scale of the change immediately. A diff with 2 additions and 0 removals is a small addition; one with 30 additions and 30 removals is a substantial rewrite.
The line-by-line output shows you the exact location of every change. Consecutive + and - lines at the same position indicate a substitution, a line was replaced. Standalone + lines with no adjacent - line indicate a pure insertion; standalone - lines indicate a pure deletion.
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.
Show formula & methodology โShow less โ
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