Text Diff Checker
Paste your original and modified text, then click Compare to see what changed. Added lines are highlighted green, removed lines red, unchanged lines grey. Runs entirely in your browser — nothing is uploaded.
Enter text in both fields and click Compare.
How to use the text diff tool
- Paste your original text in the left box and the modified text in the right box.
- Optionally check Ignore leading/trailing whitespace if you only care about content changes, not indentation.
- Click Compare. The diff appears below: green lines were added, red lines were removed, unmarked lines are unchanged.
What is a text diff?
A "diff" (short for difference) shows the minimum set of changes needed to turn one version of a text into another. Diffs are used in version control (git, SVN), code review, document comparison (contract versions, article revisions) and data validation (comparing exported CSV files, config files).
The algorithm used here is LCS (Longest Common Subsequence) — it finds the
longest sequence of lines common to both texts, then marks everything else as added or
removed. This is the same algorithm that powers diff(1), git diff
and most code-review diff views.
Frequently asked questions
- What algorithm does this use?
- Line-by-line diff using the LCS (Longest Common Subsequence) algorithm — the same approach used by diff(1) on Unix, git diff, and most code review tools. Lines present in both texts are shown as unchanged; lines only in the original are marked as removed (red); lines only in the modified text are marked as added (green).
- Is my text uploaded to a server?
- No. The diff runs entirely in your browser with JavaScript. Your text never leaves your device and works offline once the page is loaded.
- Can I diff code?
- Yes. The tool diffs any plain text, including source code, configuration files, JSON, CSV, prose and markdown. It does not apply syntax highlighting, but the line-level diff correctly handles indentation and punctuation.
- How large a text can I compare?
- The LCS algorithm has O(n×m) time complexity, so very large files (thousands of lines) may be slow. For documents up to a few hundred lines the diff is instantaneous. For large files, consider a desktop diff tool (diff, vimdiff, VS Code compare) instead.
- What does "ignore whitespace" do?
- When checked, each line is trimmed before comparison, so a line with only a leading-space change is treated as unchanged. This is equivalent to diff -b on Unix — useful for comparing code that was reformatted or re-indented.