Diff / Text Compare
What Is a Text Diff?
A text diff (short for "difference") is a comparison between two versions of text that shows precisely what was added, removed, or left unchanged. Instead of squinting at two documents and trying to spot the differences by eye, a diff tool lines the two versions up and marks every change so you can see them at a glance. The concept comes from software development, where the original Unix diff utility has been used since the 1970s to track edits between file revisions, but the same idea applies to any text: configuration files, contracts, articles, log output, or translations.
This tool performs a line-by-line comparison using a Longest Common Subsequence (LCS) algorithm. LCS is the same technique that powers version control systems like Git: it finds the largest set of lines that appear in the same order in both versions, treats those as unchanged context, and classifies everything else as an addition or a deletion. The result is the smallest, most readable set of changes rather than a noisy character-by-character dump. Each line is tagged as an addition, a deletion, or unchanged, and the output preserves the original line numbers from both sides so you always know where in each document a change occurred.
How to Use This Diff Checker
Paste the first version of your text into the Original Text box on the left and the second version into the Modified Text box on the right. Click Compare to generate the diff. The tool renders a table where each row shows the original line number, the new line number, a prefix marker (+ for additions, - for deletions, a space for unchanged lines), and the line content itself. Added lines are highlighted in green and removed lines in red.
Above the output you'll see a summary counter showing the total number of additions, deletions, and unchanged lines. Use the Swap button to flip the two sides if you pasted them in the wrong order, which instantly reverses the direction of the comparison. The Clear button empties both panes and hides the results so you can start a fresh comparison.
Real-World Use Cases
- Code review — paste an old and new version of a function or config file to see exactly which lines a colleague changed before approving a pull request.
- Proofreading and editing — compare a draft against an edited version of an article, email, or contract to confirm every revision an editor made.
- Configuration auditing — diff a working server or app config against a broken one to pinpoint the setting that was accidentally altered.
- Log comparison — line up two log outputs from different runs to find where behaviour diverged during debugging.
- Translation and localization checks — compare an original string file against a translated or updated one to verify which entries still need attention.
Tips for Comparing Text
- The comparison is line-based, so a single changed word will mark the whole line as removed and re-added — break long paragraphs onto separate lines if you want finer-grained results.
- Trailing whitespace and invisible differences in indentation count as changes; normalize spacing first if you only care about content.
- Use Swap when you realize the "before" and "after" are reversed, rather than re-pasting both sides.
- The line-number columns show the position in each version independently, which helps when lines shift up or down due to insertions.
- For very large inputs, remember the LCS algorithm compares every line against every other line, so trimming to the relevant section keeps the comparison fast.
Features
- Line-by-line LCS diff — uses a Longest Common Subsequence algorithm to find the minimal, most readable set of changes.
- Color-coded output — additions in green, deletions in red, unchanged lines as plain context.
- Change statistics — a live counter of additions, deletions, and unchanged lines.
- Dual line numbers — shows the line position in both the original and modified text.
- Swap and Clear — flip the two inputs or reset everything in one click.
- 100% client-side — your data never leaves your browser.
Frequently Asked Questions
Does this tool compare word by word or line by line?
The comparison is performed line by line. Each line in the original is matched against lines in the modified text, so even a small change within a line marks that entire line as removed and the new version as added.
What do the green and red highlights mean?
Green rows marked with a + are lines that exist only in the modified text (additions), and red rows marked with a - are lines that exist only in the original text (deletions). Unmarked rows are unchanged lines shown for context.
Is my text sent to a server?
No. The entire comparison runs in your browser using JavaScript, so your text is never uploaded, stored, or transmitted anywhere. You can even use the tool offline once the page has loaded.
Can I compare source code or just plain text?
You can compare any text, including source code, JSON, configuration files, CSV data, or prose. The tool treats every line as plain text and does not require a specific language or format.
Why is a line shown as both removed and added when I only changed a few words?
Because the diff operates on whole lines, any change inside a line makes the old line no longer match the new one. The original line is reported as a deletion and the edited line as an addition, even if most of the words are the same.
Is there a size limit on how much text I can compare?
There is no hard limit imposed by the tool, but because the LCS algorithm compares every line against every other line, very large inputs with thousands of lines may take longer to process and use more memory in your browser.