Text Diff

Compare two text blocks and highlight added, removed, and unchanged lines side by side.

How the Diff Works

The tool uses the Longest Common Subsequence (LCS) algorithm — the same algorithm behind git diff. It finds the maximum set of lines that appear in both texts in the same order, then marks the rest as additions or deletions.

Lines are compared exactly — whitespace matters. A line with a leading space is different from one without.

Use Cases

  • Comparing two versions of a config file
  • Reviewing changes to documentation or markdown files
  • Checking log outputs before and after a fix
  • Comparing API response bodies across environments
  • Spotting differences in SQL query output

Frequently Asked Questions

Use the JSON Diff tool — it understands JSON structure and ignores key ordering differences, which this text-level diff cannot do.

Yes — lines are compared as exact strings including leading/trailing whitespace. Normalize indentation before diffing if you only care about content.

The LCS algorithm runs in O(m×n) time and memory. For very large files (10,000+ lines each), performance may degrade. Use git diff for large codebases.

No — binary files contain non-text bytes. This tool is designed for plain text content only.

Related Tools