Text Diff
Compare two text blocks and highlight added, removed, and unchanged lines side by side.
How the Diff Works
The tool computes a Longest Common Subsequence (LCS) between the two texts — the maximum set of lines that appear in both, in the same order — then marks everything else as an addition or a deletion. This is the same underlying problem git diff solves, though git specifically uses Myers' algorithm, a more efficient way of finding that same shortest edit script (see below for the difference).
Lines are compared exactly — whitespace matters. A line with a leading space is different from one without.
This Tool's LCS vs. Git's Myers Diff
Both approaches solve the same underlying problem — find the smallest set of line changes that turns text A into text B — but differ in how efficiently they get there:
| This tool (classic LCS) | Git diff (Myers) | |
|---|---|---|
| Published | Foundational CS algorithm | Eugene Myers, 1986 — "An O(ND) Difference Algorithm" |
| Time complexity | O(m×n) — grows with both texts' full length | O(ND) — grows with the number of differences, not total size |
| Best for | Typical text blocks, config files, short documents | Very large files where most lines are unchanged |
| Result | Same correct minimal diff | Same correct minimal diff, computed faster at scale |
For the sizes most people paste here — a few hundred to a few thousand lines — the difference is imperceptible. Myers' advantage shows up on huge files with small diffs, which is exactly git's use case (comparing full source files where only a handful of lines actually changed).
Use Cases
- ▸Comparing config file versions — See exactly which lines changed between two versions of a YAML, .env or INI file before deploying.
- ▸Reviewing documentation changes — Diff two drafts of a README or markdown doc without needing a git repository set up locally.
- ▸Checking log output before/after a fix — Paste log output from before and after a code change to confirm the fix altered exactly the lines you expected.
- ▸Comparing API responses across environments — Spot drift between a staging and production response body that should otherwise be identical.
- ▸Spotting differences in query output — Compare two SQL result dumps or CLI outputs line by line without opening a full diff tool or IDE.