T
DataToolings

Text Diff

Compare two texts and highlight differences

What is Text Diff?

Text Diff is a free online tool that compares two texts and highlights the differences between them. It uses a line-by-line comparison algorithm to show added, removed, and unchanged lines. Perfect for comparing code, documents, configuration files, or any text content.

How to Use Text Diff

  1. Paste or type your original text in the left panel (Text 1)
  2. Paste or type your modified text in the right panel (Text 2)
  3. Click the Compare button to see the differences
  4. Review the highlighted changes: green for added lines, red for removed lines
  5. Copy the diff output to clipboard if needed

Features

  • Line-by-line text comparison with LCS algorithm
  • Color-coded diff output (green for additions, red for deletions)
  • Line numbers for easy reference
  • Statistics showing added, removed, and unchanged lines
  • Copy diff output to clipboard
  • Sample data for quick testing
  • Works with any text format (code, documents, logs, etc.)

Frequently Asked Questions

What algorithm does this tool use?

This tool uses the Longest Common Subsequence (LCS) algorithm to compute differences between texts. It's the same algorithm used by popular diff tools like Git diff and Unix diff.

Can I compare code files?

Yes, this tool works with any text content including source code, configuration files, logs, documentation, and plain text. The monospace font makes it especially suitable for code comparison.

How do I read the diff output?

Lines highlighted in green with a "+" prefix are additions (present in Text 2 but not in Text 1). Lines highlighted in red with a "-" prefix are deletions (present in Text 1 but not in Text 2). Unchanged lines have no highlighting and no prefix.

Is my text data stored anywhere?

No, all text comparison happens in your browser. Your data is never sent to any server and is not stored anywhere. Everything stays private on your device.