Text Diff Checker

Compare two blocks of text and highlight the differences.

Overview

Compares two text passages, code files, or documents side by side, highlighting added, deleted, and modified character differences using the Myers Diff algorithm.

Formula & Calculation Method

Edit_Script = Shortest_Edit_Path(Myers_Diff_Algorithm(Sequence_A, Sequence_B))

Computes the minimal sequence of insertions and deletions required to transform Text A into Text B with line-by-line and character-level diffing.

Worked Example: Comparing Code Revisions

Inputs: Original: 'const total = price * 1.18;' | Revised: 'const total = price * (1 + taxRate);'

  • Tokenize lines and characters into comparable arrays.
  • Calculate longest common subsequence (LCS).
  • Highlight '1.18' as deleted (- red) and '(1 + taxRate)' as inserted (+ green).

Summary: 1 Modification Detected | Character Diff Highlighted | Zero Data Uploaded

Common Use Cases

  • Code Review Verification: Inspect changes between function refactorings before opening pull requests.
  • Contract & Legal Comparison: Compare revised contract clauses to spot subtle wording modifications.
  • Configuration Drift Detection: Compare production server configs against staging templates.

Frequently Asked Questions

How does Git calculate diffs?

Git uses Eugene Myers' O(ND) difference algorithm to find the shortest edit path between two sequences of lines.

What is CRLF vs LF?

Windows uses Carriage Return + Line Feed (\r\n), while Linux/macOS uses Line Feed (\n); whitespace toggles account for this difference.

Is my proprietary code kept private?

Yes, difference calculation executes entirely client-side in your local browser memory.

Related Calculators & Tools