Text Diff Tool
Compare two texts and see differences highlighted. Runs in your browser — nothing is uploaded.
Read more: Compare Two Texts and See the Differences
How Text Diff Works
A text diff tool compares two versions of text and identifies what has changed. This tool uses the Longest Common Subsequence (LCS) algorithm, a well-known dynamic programming technique, to find the best alignment between the two inputs.
The process works in three steps: first, both texts are split into arrays of lines. Next, the LCS algorithm determines the largest set of lines that appear in both texts in the same order. Finally, lines that are only in the original are marked as removed, lines only in the modified text are marked as added, and shared lines are left as context.
Unified vs Side-by-Side Diff
Unified diff shows changes in a single column with + and - prefixes. It is compact and is the format used by Git and most version control tools. The "Copy Diff" button in this tool outputs unified diff format.
Side-by-side diff shows the original and modified text in two parallel columns. It can be easier to read for large files but takes more horizontal space. This tool shows an inline view with line numbers from both sides for a balance of readability and compactness.
When to Use a Diff Tool
- Code reviews — compare two versions of a source file to see what changed.
- Document editing — spot changes between draft versions of contracts, essays, or notes.
- Configuration files — verify differences between staging and production config.
- Debugging — compare expected output vs actual output to pinpoint issues.
- Data validation — check that a data transformation preserved the right content.
Frequently Asked Questions
Can I compare very large texts?
Yes. For texts up to 5,000 lines, the tool uses an optimized LCS algorithm. For larger inputs, it falls back to a faster line-by-line comparison to keep performance smooth.
What does the "Copy Diff" button produce?
It copies the differences in unified diff format, the same format used by Git. Lines starting with + are additions, lines starting with - are removals, and lines without a prefix are context lines.
Does this tool send my data anywhere?
No. Everything runs in your browser using JavaScript. Your text never leaves your device.