How to use
- Enter the original text (A) on the left and the text to compare (B) on the right.
- Click "Compare".
- Added lines are shown in green, removed lines in red.
๐ฏ Use Cases
- Check differences between two versions of a document or code โ a quick way to compare two blocks of text when git diff isn't handy
- Compare a contract or terms of service before and after revision โ see exactly which clauses were added, removed, or edited, line by line
- Review changes to a configuration file โ check what changed in config or env files before and after a deploy
- Proofread a translation โ after editing the source text, spot lines that never made it into the translated version
Example
Original (A) name: web version: 1.0.0 port: 8080 Compare (B) name: web version: 1.1.0 port: 8080 debug: true
name: web - version: 1.0.0 + version: 1.1.0 port: 8080 + debug: true
A line-by-line comparison of two config files. The changed version line is split into a removal (-) and an addition (+), while the debug line that exists only in B is shown as an addition (+).
How does the LCS algorithm work?
This tool uses LCS (Longest Common Subsequence), the same family of algorithm behind git diff. It finds the longest sequence of lines that appears in both texts in the same relative order, then marks only the lines outside that sequence as added or removed. This means that if a few lines are inserted or deleted in the middle, the remaining identical lines are still correctly recognized as "unchanged" โ a naive index-by-index comparison would instead treat every line after the insertion point as different, which LCS avoids.
| Method | Behavior | Downside |
|---|---|---|
| Naive line-index comparison | Matches lines 1:1 by the same index | A single inserted line makes everything after it look different |
| LCS-based (this tool) | Finds the common subsequence and shows the minimal diff | A fully reordered line shows up as a removal + addition |
FAQ
- What unit is used for comparison?
- Comparison is done line by line. Even if only a word within a line differs, the whole line is marked as changed.
- Is my text sent to a server?
- No. Comparison uses an LCS (longest common subsequence) algorithm and runs entirely in your browser.
- What happens if lines are just reordered?
- Even identical content is shown as a removal (-) at its old position and an addition (+) at its new position, because LCS only recognizes common lines that keep their relative order.
- Can I upload files to compare?
- Currently only pasted text is supported. Open the file, copy its contents, and paste them in.
๐ Learn more: How to Compare Two Text Files (Diff Checker)
Quickly spot differences between two versions