Homeโ€บFormattersโ€บTextโ€บText Diff Checker

Text Diff Checker

Text

Compare two texts and see added, removed, and unchanged lines highlighted instantly. Line-by-line diff in unified format. In-browser, no data stored.

Diff Output

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

  1. Paste the original (older) version of your text into the Original Text field.
  2. Paste the modified (newer) version into the Modified Text field.
  3. Enable Ignore Case if you want to treat letter-case differences as equal.
  4. Enable Ignore Trailing Whitespace to suppress whitespace-only line differences.
  5. Read the header to get the overall change count, then scan the diff body for + and - lines.
  6. Lines with two-space prefixes are unchanged context lines.

Formula & Methodology

The formatter uses a dynamic-programming LCS implementation:

Given original lines A[1..m] and modified lines B[1..n], a table dp[i][j] stores the length of the longest common subsequence of A[1..i] and B[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])  otherwise

The diff is reconstructed by tracing back through the dp table:
- If A[i] == B[j]: line is unchanged (prefix   )
- If dp[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 dog
Modified:
The quick brown fox leaps over the lazy cat

Diff 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

A text diff formatter compares two text inputs line by line and shows which lines were added, removed, or unchanged. Lines prefixed with + were added in the modified text, lines with - were removed from the original, and lines with two spaces are unchanged. This is the standard unified diff format used by version control systems.
The formatter uses the Longest Common Subsequence (LCS) algorithm to find the maximum set of lines that appear in both texts in the same order. Lines outside the LCS are classified as additions or deletions. This is the same approach used by git diff and standard Unix diff utilities.
When enabled, comparison is done on lowercased versions of both texts. A line reading 'Hello World' and a line reading 'hello world' are treated as equal. The original casing is preserved in the output display, but the diff logic does not distinguish between upper and lower case.
When enabled, each line is trimmed of trailing spaces and tabs before comparison. This prevents spurious diff entries caused by editors that add or remove trailing whitespace. Leading whitespace (indentation) is preserved and does affect the diff.
The formatter supports up to 2,000 lines per text. Inputs larger than this are rejected with a message. The LCS algorithm's memory usage grows quadratically with line count, so very large inputs would slow down the browser significantly.
No. The diff comparison runs entirely in your browser. Neither the original nor the modified text is sent to a server. The tool is safe for comparing confidential documents, source code, or private notes.
This formatter performs a line-level diff: it compares whole lines and marks each line as added, removed, or unchanged. A character-level diff would highlight the specific characters within a line that changed. Line-level diffs are faster and easier to read for prose and code; character diffs are more useful for single-line changes.
Yes. Paste the old version into the Original field and the new version into the Modified field. The diff output shows exactly which lines changed. For large code comparisons, use the Ignore Trailing Whitespace option to avoid noise from editor-introduced whitespace differences.
The header line shows the original line count, the modified line count, and the total number of added and removed lines: `@@ -N lines +M lines; X added, Y removed @@`. This gives you a quick summary of the scale of the change before reading the individual diff lines.
If both texts are identical (accounting for any enabled normalisation options), all lines appear with two-space prefixes (unchanged). The added and removed counts in the header are both zero. This confirms the texts match.
For quick comparison of two text snippets, yes. This formatter does not have git context (commit history, file paths, hunks with context lines) so it is not a replacement for `git diff` in a development workflow. It is best for one-off comparisons of pasted text.
Also known as
text diffdiff checkercompare two textstext comparison toolfind differences text