About This Tool

What is Text Diff?

A tool that compares two texts line by line and visually highlights the differences. Useful for code change reviews, document revision tracking, and translation before/after comparison.

How to Use

  1. Enter the original text on the left.
  2. Enter the modified text on the right.
  3. Click 'Compare'.
  4. View added lines (green), removed lines (red), and unchanged lines with color coding.

Key Features

  • Line-by-line difference comparison
  • Color-coded added/removed/unchanged lines
  • Intuitive side-by-side split view
  • Change statistics (added/removed/unchanged line counts)

Tips

  • During code review, paste before and after versions to quickly identify differences.
  • When contracts or terms change, compare with previous versions to easily find modifications.
  • Line break and whitespace differences are also detected.

Text Diff

Compare two texts and highlight differences line by line


Frequently Asked Questions

How does the text diff algorithm work?

The tool uses a line-by-line diff algorithm (similar to Unix diff) that compares each line of the original and modified texts. It identifies three types of changes: added lines (new content), removed lines (deleted content), and unchanged lines. This is the same approach used by Git for showing code changes.

Can I compare formatted JSON or code files?

Yes. Paste your code or JSON directly. The tool compares line by line, so consistent formatting helps produce clearer diffs. For JSON, prettify both versions first so structural changes are easier to spot. Minified code will show up as a single large change.

Does the tool detect moved or reordered lines?

The basic diff algorithm treats moved lines as a deletion from the old position and an addition at the new position. It doesn't explicitly show 'line moved from X to Y.' For detecting rearrangements, look for matching green (added) and red (removed) lines with identical content.


Related Tools