Text Diff & Compare

Compare two texts and see differences highlighted. Find added, removed, and unchanged lines side by side. Free online diff tool.

What is Text Diff?

A text diff (difference) tool compares two pieces of text and highlights exactly what changed between them — additions, deletions, and modifications, shown line by line or character by character. It's the same concept used in Git version control, code review tools, and document comparison software. This is invaluable for verifying edits, reviewing revisions, comparing API responses, checking configuration changes, proofreading document versions, and anywhere you need to quickly identify what's different between two text variants.

How It Works

The tool implements a diff algorithm (similar to the Myers diff algorithm used in Git) that finds the longest common subsequence between two texts and identifies the minimal set of changes needed to transform one into the other. Results are displayed with color-coded highlighting: green for additions, red for deletions, and yellow for modifications. You can view differences at the line level (each changed line highlighted) or character level (exact changed characters within lines highlighted). Side-by-side and inline views are both available for different comparison needs.

Common Use Cases

  • •Comparing code changes before committing to verify only intended modifications were made
  • •Reviewing document revisions to quickly identify what an editor changed in your text
  • •Debugging API responses by comparing expected output with actual output side by side
  • •Verifying configuration file changes to ensure only intended settings were modified
  • •Comparing translated text with the original to track which passages were updated
  • •Checking two versions of a contract or legal document for differences before signing

Frequently Asked Questions

How does the diff algorithm work?▼

It compares texts line by line and highlights additions (green) and removals (red).

What is the difference between a line diff and a character diff?▼

A line diff marks a whole line as changed, which is how code review and Git present changes and is best for structured text. A character or word diff highlights the exact characters that differ within a line, which is what you want for prose where a single word changed in a long paragraph.

Why is a line marked as changed when I only edited one word?▼

Line-level diffing has no concept of a partial line: any difference makes the whole line count as removed and re-added. Switch to word or character mode to see precisely what moved.

Can it detect that a block of text simply moved?▼

Standard diff algorithms report a move as a deletion in one place and an addition in another, because they compute the shortest edit script rather than tracking identity. A large reordering therefore looks like a large rewrite.

Does it ignore whitespace and indentation changes?▼

Only if you ask it to. Ignoring whitespace is essential when comparing reformatted code, where re-indentation would otherwise flag every line. Keep whitespace significant when it carries meaning, as in Python, YAML or Markdown.

Is my text uploaded anywhere for comparison?▼

No. Both versions are compared in your browser and neither is transmitted, which is why the tool is safe for comparing contracts, credentials or unreleased code.

Related Tools

More from Text Tools: