Text Diff

Compare two texts and highlight differences — line by line diff with added, removed, and changed lines.

About Text Diff

Text diffing (differencing) is the process of computing the difference between two versions of a text, showing which lines were added, removed, or unchanged. It is one of the most fundamental operations in software development — version control systems like Git use diff algorithms to track every change in source code history.

This tool performs a line-by-line diff of two text inputs, highlighting added lines in green and removed lines in red. It uses the Longest Common Subsequence (LCS) algorithm to find the minimal set of changes that transforms Text A into Text B, producing a clean and easy-to-read diff output.

Common use cases include comparing two versions of a configuration file, reviewing document edits, spotting differences between API responses, comparing two SQL schemas, and verifying that a text transformation produced the expected output.

Frequently Asked Questions

What does "ignore whitespace" do?
When enabled, lines that differ only in leading/trailing spaces or indentation are treated as identical. This is useful when comparing code that has been reformatted or has inconsistent indentation, where you only care about content changes.
Is this the same as Git diff?
This tool implements a similar LCS-based line diff algorithm that Git uses. However, Git diff has additional features like hunk context (showing a few lines around each change), word-level diffing within lines, and binary file detection. This tool focuses on clean, readable line-level diffs.
Can I compare JSON or code with this?
Yes, this tool works on any text including JSON, code, configuration files, and prose. For JSON specifically, use the JSON Diff tool which understands JSON structure and can compare by key paths rather than just raw lines.