Client-Side Diff Checker & Text Comparer
Compare two blocks of text and instantly see what changed — added lines highlighted in green, removed lines in red, with the unchanged lines kept in place.
Interactive Client Prototype Sandbox
Disclaimer: This free tool is provided “as is,” without warranties of any kind, and is for general informational purposes only — not professional, legal, financial, medical, tax, or engineering advice. Results may contain errors; verify anything important independently and use at your own risk. We accept no liability for any loss or damage arising from its use. See our Terms of Use for details.
Step-by-Step Guide
Paste the original version of your text into the left input box and the modified version into the right input box. The diff output below updates automatically — added lines are highlighted green with a + prefix, removed lines are red with a − prefix, and unchanged lines are shown in neutral color for context.
How the comparison works
The tool compares text line by line using the Longest Common Subsequence (LCS) algorithm. LCS finds the maximum number of lines that appear in both versions in the same order (without requiring them to be adjacent), then marks everything not in the common sequence as either added or removed. This means moved blocks are shown as a deletion from the original position and an addition at the new position — the tool does not detect moved blocks as moves.
Practical tips
For comparing code, paste with consistent indentation — a line that differs only in leading spaces will be marked as changed. For comparing prose, consider pasting one sentence per line if you want character-level change visibility (the tool highlights the whole changed line, not individual changed words). The tool handles arbitrarily long documents since everything runs locally in your browser.
Original text: Alpha Beta Gamma
Modified text: Alpha Zeta Gamma
Diff output: Alpha (unchanged) - Beta (removed from original) + Zeta (added in modified) Gamma (unchanged)
For a code example: compare two versions of a config file where a port number changed from 8080 to 3000 — only the changed line is highlighted, all surrounding context lines remain neutral.
Who it's for
Translators, legal clerks, code reviewers, students, and content editors tracking revisions.
Core Features
- LCS-based line diff that correctly detects insertions, deletions, and reordered blocks.
- Added lines in green (+) and removed lines in red (−), with unchanged lines for context.
- Two simple input boxes — paste your original and modified text.
- Runs entirely in your browser — nothing is uploaded, so it's safe for confidential text.
🛡️ No tracking — your inputs, keys, and details never leave this client sandbox.
Related tools
How do I compare two pieces of text?
Paste the original into the first box and your edited version into the second. The comparison below updates live, marking added lines in green with a + and removed lines in red with a −, so you can see exactly what changed.
Does it compare line by line or character by character?
It compares line by line, using a longest-common-subsequence (LCS) algorithm. That means inserted, deleted, and moved lines are identified correctly rather than everything after a change being flagged — but it marks whole changed lines, not individual characters within a line.
Is my text uploaded to compare it?
No. The entire diff runs in your browser, so you can safely compare contracts, code, or private drafts — nothing is sent to a server.
What can I use a diff checker for?
Spotting edits between two versions of a document, reviewing changes to code or config, checking what a collaborator altered, or confirming a copy-paste matches the original.
Can it show differences within a line, not just between whole lines?
This tool compares at the line level — it marks entire changed lines as added or removed, not the specific characters within a line that changed. For intra-line diffing (character-level highlighting), dedicated code review tools like GitHub's diff view or VS Code's diff editor are more appropriate. Line-level diffing is faster and clearer for most document comparison tasks.
Why does moving a block of text show as deleted and re-added?
The LCS algorithm finds the longest common subsequence in order — it does not have a concept of 'moving' a block. A paragraph that appears in different positions in the two versions will appear as deleted from its old position and added at its new position, because from the algorithm's perspective, the order of matching lines has changed. Some more advanced diff tools implement move detection as a post-processing step on top of the basic LCS output.
How does a computer decide what 'changed' between two documents?
When you paste two versions of a text and expect the tool to highlight the differences, the question seems obvious — but the algorithm behind the answer is not. Two texts can differ in ways that are easy for a human to characterize ('a paragraph was moved') yet genuinely ambiguous for an algorithm ('is this a deletion followed by an insertion, or a modification in place?'). The answer that diff tools settled on decades ago is to frame the problem as finding the Longest Common Subsequence, then calling everything outside that subsequence either added or removed.
What the LCS algorithm actually does
Given two sequences A and B, the Longest Common Subsequence is the longest sequence of elements that appears in both A and B in the same relative order, but not necessarily contiguously. The classic dynamic programming algorithm for LCS runs in O(m×n) time and space, where m and n are the lengths of the two sequences. For large documents, this can be slow — practical implementations use optimizations like the Hunt-Szymanski algorithm or the diff algorithm introduced by Myers (1986), which runs in O(n + d²) time where d is the number of differences. Once the LCS is found, anything in A that is not in the LCS is marked as removed; anything in B that is not in the LCS is marked as added.
The diff output format
The standard unified diff format — originated with Unix diff tools in the 1970s and widely adopted in version control systems — marks removed lines with − and added lines with +, with a configurable number of context lines around each change to orient the reader. This format is human-readable and machine-parseable. Git's diff output, GitHub's pull request review interface, and most code review tools use this format (with syntax highlighting added on top).
Why this matters for version control
Diff algorithms are foundational to version control systems like Git. Every commit in Git stores not the full file state but the set of changes (the diff) from the previous commit — a compact representation of what changed. Git's diff engine uses the Myers diff algorithm for line-level diffs and can also perform word-level and character-level diffs within changed lines. The ability to inspect exactly what changed between any two versions of a file is what makes version control useful for collaboration and auditing. A browser-based diff tool applies the same principle without requiring a repository — useful for comparing documents, config files, or drafts that exist outside version control.