Text Diff Checker

Find every added, removed and unchanged line, word or character. Unified and side-by-side views, similarity scoring and CSV export.

Free · Instant · Private
Quick answer: A diff is the longest common subsequence of two token sequences. Tokens in that subsequence are unchanged; everything else is either a deletion from the original or an addition in the modified text. Similarity is 2 x matches / (original + modified) x 100. Paste both versions below to see the result instantly, with no upload.
Difference view
Plain text diff (copyable)
CSV export (copyable)

What Is a Text Diff?

A diff is a compact description of how one version of a text differs from another. Instead of storing two complete copies, a diff records only the pieces that were added, removed or kept. It is the mechanism behind code review, version control, legal redlining, translation memory, configuration audits and plagiarism checks.

Most diff tools work on tokens. A token can be a whole line, a single word, or a single character. The tool below lets you choose which one matters for your task. The output is deterministic: the same two inputs with the same options always produce the same result.

How a Diff Algorithm Works

The core idea is the longest common subsequence, often abbreviated LCS. A subsequence is a set of tokens that appear in both texts in the same order, with gaps allowed. The longest such set is treated as the unchanged portion of the text. Every token before, between or after those matches is reported as a deletion from the original or an addition in the modified version.

Dynamic programming table

For two token sequences A of length n and B of length m, the algorithm fills a table where cell (i, j) holds the LCS length of the first i tokens of A and the first j tokens of B. When two tokens match, the cell is table(i-1, j-1) + 1; otherwise it is the larger of table(i-1, j) and table(i, j-1). Walking backwards from the bottom-right cell reconstructs the diff. Ties are resolved in favour of deletions so the result is stable.

Complexity and safety limits

The table needs n x m cells, so both time and memory grow with the product of the two input sizes. To keep the page responsive, this tool caps the dynamic programming table and falls back to a prefix-and-suffix comparison for very large inputs, clearly reporting when that happens. For typical documents, code files and configuration snippets the full algorithm runs instantly.

Diff Granularity: Lines, Words and Characters

GranularityTokenBest forTrade-off
LinesOne line of textSource code, logs, config files, CSV rowsA single changed character marks the whole line as changed.
WordsWord or whitespace runProse, contracts, product descriptions, translationsLine breaks become ordinary whitespace tokens.
CharactersOne Unicode characterShort strings, identifiers, hashes, one-line valuesLong texts create many tokens and noisier output.

For changed lines the unified view goes one step further: it runs a word-level diff inside each paired deletion and addition, so the exact words that changed are highlighted rather than the entire line.

Worked Examples

ScenarioOriginalModifiedExpected result
Identical textsalpha betaalpha beta0 additions, 0 deletions, 100% similarity.
One line replaceda, b, ca, x, c1 deletion, 1 addition, 2 unchanged lines.
Line inserteda, ca, b, c1 addition, 2 unchanged lines.
Line removeda, b, ca, c1 deletion, 2 unchanged lines.
Case-only change, ignore case onHellohello0 changes; original spelling is still displayed.
Whitespace-only change, trim on valuevalue0 changes when trim lines is enabled.
Empty inputs(empty)(empty)No differences and 100% similarity.
Completely differentonetwo1 deletion, 1 addition, 0% similarity.

Reading the Output: Symbols and Views

Symbol or colourMeaningAppears in
- and red backgroundPresent in the original, missing from the modified text.Unified view, plain text diff, CSV
+ and green backgroundAdded in the modified text, not in the original.Unified view, plain text diff, CSV
Blank prefix and white backgroundUnchanged token present in both texts.Unified view, plain text diff, CSV
[- ... ] and {+ ... }Inline markers for changed runs in word and character mode.Plain text diff
Two aligned columnsOriginal on the left, modified on the right, with blank cells for missing rows.Side-by-side view

Note that red and green here describe insertions and deletions, not correctness. A green line is simply new text, not necessarily a better one.

Inline word-level highlighting

When a deleted line is paired with an added line, the tool runs a second word-level comparison on just those two lines. Unchanged words stay plain while the specific words that changed receive a stronger highlight, which makes edits inside long paragraphs easy to spot.

Similarity Score and Change Statistics

The tool reports four counts: added tokens, removed tokens, unchanged tokens and the total number of tokens in each text. The similarity percentage is the Dice-style coefficient:

similarity = 2 x matching tokens / (tokens in original + tokens in modified) x 100

Two identical texts give 100%, and two texts with no common tokens give 0%. Because it is symmetric, swapping the two sides never changes the score. A text that is a strict subset of the other scores less than 100% because the denominator includes both totals.

Edge cases and empty inputs

Two empty texts produce no differences and a similarity of 100%. An empty original with a non-empty modified text produces only additions and a similarity of 0%. Normalisation options can also produce a 100% match even when the displayed characters differ, because the comparison uses the normalised keys rather than the raw text.

Everyday Uses

  • Code review: see exactly which lines a commit changed before approving it.
  • Contract redlining: spot a single changed clause in a long agreement.
  • Content editing: compare a draft with the published version and export the differences.
  • Data cleaning: compare two exports of a customer list or a configuration file.
  • Translation QA: find source segments that were edited after translation.
  • Study and revision: check your retyped notes against the original.

If you also need to count words and characters, try the Word Counter. For pattern-based checks before diffing, the Regex Tester and Validator is a useful companion.

Common Mistakes

  1. Comparing files with different line endings. Normalise CRLF and LF first; this tool treats them equivalently.
  2. Forgetting trailing newlines. A final blank line is dropped so it does not appear as a phantom change.
  3. Diffing formatted output as lines. When a whole paragraph is one line, switch to word granularity.
  4. Treating a move as a single change. A relocated block is reported as one deletion plus one addition.
  5. Enabling ignore options too aggressively. Ignoring whitespace can hide meaningful indentation changes in code.
  6. Assuming the diff understands meaning. It compares token sequences, not semantics.

Key Takeaways

  • A diff is built from the longest common subsequence of two token sequences.
  • Line diff suits code, word diff suits prose, and character diff suits short strings.
  • Similarity equals twice the matching tokens divided by the combined token count.
  • Normalisation options change the comparison keys but never the displayed text.
  • Moved content appears as a deletion plus an addition, not as a move.
  • Everything is computed in the browser, so sensitive text never leaves your device.

Authoritative References

  • POSIX.1-2017, diff utility and the specification of normal, unified and context diff formats.
  • Eugene W. Myers, An O(ND) Difference Algorithm and Its Variations, Algorithmica, 1986.
  • J. W. Hunt and T. G. Szymanski, A Fast Algorithm for Computing Longest Common Subsequences, Communications of the ACM, 1977.
  • Douglas McIlroy and the original UNIX diff implementation described in Bell Laboratories technical reports.
  • W3C HTML Standard, text node and whitespace handling in rendered documents.

Last updated: December 5, 2026 · All comparisons are performed locally in your browser. No data is stored or transmitted.

Text Diff Checker FAQ

What is a text diff checker?

A text diff checker compares two versions of a text and reports exactly which lines, words or characters were added, removed or left unchanged.

What algorithm does this diff checker use?

It computes a longest common subsequence with dynamic programming, then reports the tokens that are not part of that subsequence as additions and deletions.

What is the difference between line, word and character diff?

A line diff compares whole lines, a word diff compares individual words and whitespace tokens, and a character diff compares single Unicode characters. Choose line diff for code and word diff for prose.

What does the similarity percentage mean?

Similarity is twice the number of matching tokens divided by the total number of tokens in both texts, expressed as a percentage. Identical texts score 100 percent and completely different texts score 0 percent.

How do I ignore whitespace-only changes?

Enable the ignore whitespace option or the trim lines option. The comparison then uses normalised keys while the display still shows the original text.

Can I compare large documents?

Yes, but very large inputs are capped to keep the browser responsive. When the token limit is exceeded the tool reports the limit and falls back to a prefix and suffix comparison.

Is there a limit to what the checker can detect?

A diff reports positional changes, not semantic meaning. Moved blocks appear as a deletion plus an addition rather than as a single move.

Is my text uploaded anywhere?

No. Both texts are compared locally in your browser with JavaScript. Nothing is sent to a server, stored, or logged.