TextToolboxTextToolbox
HomeText Extraction / AnalysisText Difference Checker

Text Difference Checker

Compare physical lines and highlight word runs within paired changes. Keep original text and copy a readable comparison report.

Built by Saurabh Kumar

Quick Answer

Compare two text selections by physical line, with optional word-run highlights. Ignore case and leading whitespace affect comparison keys only. The view retains both originals and reports unchanged, modified, added and removed counts. Copy Diff produces a readable report, not a Git patch.

Each input: up to 200,000 UTF-16 units and 2,000 physical lines. CRLF, LF and CR delimit lines; their spelling is ignored in comparison. Trailing blank lines count. Word Diff has a separate token/comparison budget and may require a smaller selection.

0 UTF-16 units

0 UTF-16 units

Both inputs are empty.

Original lines
0
Modified-side lines
0
Unchanged pairs
0
Modified pairs
0
Added lines
0
Removed lines
0
Aligned rows
0

Word Diff compares whitespace runs and non-whitespace runs inside paired modified lines. Punctuation stays with its run. Changed tokens are marked; status labels also identify changes without relying on color.

Report records both original line contents and endings as JSON strings, including empty lines. It is a readable comparison report, not a Git patch. Browser input and clipboard newline handling can differ.

What Is the Text Difference Checker?

Compare two text selections by physical line, with optional word-run highlights. The view keeps each side’s original case, whitespace and line numbering. It shows unchanged pairs, nearby modified pairs and unpaired additions or removals. It does not understand code syntax, validate translations or detect plagiarism.

How to Use the Text Difference Checker

  1. Paste your original into A and the revision into B, or choose Sample.
  2. Start with Line Diff. Use Word Diff for highlights within paired changed lines.
  3. Enable Ignore case or Ignore leading whitespace only when those distinctions do not matter. Trailing whitespace remains significant.
  4. Inspect both sides and their labels. Swap reverses direction; Clear removes both inputs.
  5. Use Copy Diff for the selectable comparison report. If copying fails, select that report and copy it manually.

How the Text Difference Checker Works

A longest common subsequence finds matching line-content keys. On ties, the original side is consumed first. Removed and added lines between common anchors are paired by position; unmatched extras stay added or removed. Different valid alignments can exist for repeated or reordered lines. A modified pair is a display pairing, not proof that one sentence evolved from the other.

CRLF, LF and CR are recognized as separators; separator spelling is ignored for comparison, while a trailing separator creates a counted empty line. Ignore options affect comparison keys, not displayed source. Ignore case uses JavaScript lowercase mapping, not locale-specific or complete Unicode case folding. Word Diff tokenizes whitespace and non-whitespace runs, keeping punctuation attached. It is not language-aware word segmentation.

Line alignment permits at most four million comparison cells. Word alignment allows 500,000 cells across all modified pairs and 10,000 tokens per paired line. Over-limit input gives an error rather than a truncated result. Work is synchronous; these caps are safeguards, not a guarantee of responsiveness on every device.

Text Difference Checker Example

In the examples, \n denotes a line break and \t denotes a tab. Leading spaces are meaningful.

Exact line and comparison-rule outcomes
Original AModified BSettings and outcome
Keep\nold cat\nKeep\nnew cat\nThree lines each: two unchanged pairs, one modified pair. Word Diff marks old and new.
HellohelloIgnore case and leading whitespace: one unchanged pair under the rules. The original texts still differ.
A\nAOne unchanged pair and one removed empty line. Counts: two original lines, one modified-side line.

When to Use the Text Difference Checker

Draft revisions

Inspect a small paragraph or list after editing, including punctuation and spacing.

Configuration snippets

Check literal lines before making a change. This view does not validate syntax or build an applicable patch.

Copied text checks

Check whether a pasted selection has lost a blank line or changed wording.

Review handoff

Share the comparison report with both source line contents and the rules used.

Common Mistakes

An unchanged pair under ignore rules is not necessarily an exact text match. Blank lines count; absent lines are labeled separately. Added and removed counts exclude paired modifications, so original lines equal unchanged plus modified plus removed, and modified-side lines equal unchanged plus modified plus added.

Do not apply Copy Diff output with Git. Git patch formats require file and hunk information. This report instead records both sides as escaped JSON strings. Highlighting is rendered as text nodes, so pasted HTML is text rather than active markup.

Tips for Better Results

Compare a focused selection and review repeated-line alignments carefully. If Word Diff exceeds its budget, switch to Line Diff or shorten the changed lines. Use Change Case only when you intend to change capitalization; an ignore option here leaves both inputs untouched.