> diff | compare | merge <
// Compare two texts and highlight the differences instantly
Side-by-Side View
View original and modified text side by side with aligned differences for easy comparison.
Color-coded Diff
Added lines highlighted in green, removed lines in red, and unchanged lines in gray for instant recognition.
Line-by-Line Comparison
Precise line-by-line diff with line numbers. 100% client-side, your data never leaves your browser.
// ABOUT TEXT DIFF
How Diff Works:
The diff algorithm uses the Longest Common Subsequence (LCS) technique to find the optimal alignment between two texts. It builds a dynamic programming table to identify matching lines, then backtracks to produce a minimal set of additions and deletions.
Example:
Original: "hello world" | Modified: "hello there" → removed "world", added "there"
Common Use Cases:
- >Code review and version comparison
- >Document revision tracking
- >Configuration file change detection
- >Merge conflict resolution
- >Content audit and proofreading
>> frequently asked questions
Q: What is a text diff?
A: A text diff (short for "difference") is a comparison between two pieces of text that shows what has been added, removed, or left unchanged. It is widely used in software development, document editing, and version control systems like Git.
Q: How does the diff algorithm work?
A: This tool uses the Longest Common Subsequence (LCS) algorithm. It builds a dynamic programming table to find the longest sequence of lines common to both texts, then determines which lines were added or removed relative to that common subsequence.
Q: What is the difference between line diff and word diff?
A: Line diff compares texts line by line, showing entire lines as added, removed, or unchanged. Word diff compares at the word level within lines, highlighting individual word changes. This tool uses line-level diff for clarity and performance.
Q: How can diff help with merge conflicts?
A: When two people edit the same file, a diff tool helps visualize what each person changed. By comparing the original with both modified versions, you can identify conflicting changes and decide how to merge them together.
Q: What are common diff tools?
A: Popular diff tools include GNU diff, git diff, Beyond Compare, WinMerge, and Meld. Online diff checkers like this one provide quick browser-based comparisons without installing any software.
// OTHER LANGUAGES
References
How we make sure
We check this tool with the automated test suites linked below. Example checks are shown in their original language.
- Verification method
- Reconstruct both inputs from edit operations and check exact line content/order.
- Comparison reference
- The two original documents as invariant baselines.
- Verification scope
- This checks operation correctness, not uniqueness or minimality of the diff.
Test source and cases (select a file to read it)
-
legacy-reliability.test.js
- Diff checker: edit operations reconstruct both input documents with exact line ordering
These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.