Text diff
Compare two texts in your browser with Google's diff-match-patch. Additions and deletions are highlighted after semantic cleanup. Nothing uploaded.
Text diff compares two strings in your browser using Google's diff-match-patch library. Deletions appear with strikethrough, additions are highlighted, and unchanged text is shown normally. This is character-level comparison with semantic cleanup — not a line-based git diff. Nothing is uploaded.
How it works
- Paste your texts. Put the original version in the left box and the modified version in the right box.
- Click Compare. The tool runs
diff_mainfollowed bydiff_cleanupSemanticto find and group changes. - Review differences. Deleted text appears with strikethrough. Added text is highlighted. Unchanged text shows normally.
Character-level vs line-based diffs
This page compares two pasted strings with Google's diff-match-patch. Click Compare to run diff_main and then diff_cleanupSemantic. The result is a character-level list of equal / delete / insert hunks, rendered inline. It is not a line-based git diff and not CPython difflib (unified_diff, ndiff), which split on newlines first. Node has no stdlib diff. The page does not call diff_linesToChars (the library's optional line mode). For the how-to, see Compare Two Texts with diff-match-patch.
| Aspect | This page | Line-based |
|---|---|---|
| Granularity | Characters after semantic cleanup | Whole lines, then hunks |
| Library | diff-match-patch | git diff; CPython difflib |
| Line mode | Not used (no diff_linesToChars) | Default for git and unified_diff |
| Output | Inline HTML: strikethrough delete, highlight insert | Unified ---/+++/@@ or ndiff prefixes |
| Unicode | No normalize(); NFC ≠ NFD | Also raw unless you pre-normalize |
| Input | Two paste boxes; no file path | File paths or stdin |
NFC é (U+00E9) and NFD é (e + U+0301) are different strings here — Compare does not call String.prototype.normalize. To compose them first, use Unicode NFC / NFD. Replacements are a deletion next to an insertion; there is no single “changed” color and no unified-diff download. Newlines stay in the hunks and render as line breaks. The fox / dog pair is a character-level replace of brown→red, jumps→jumped, and lazy→sleeping. Nothing is uploaded.
FAQ
- Does this tool upload my text?
- No. All comparison runs in your browser using diff-match-patch. Your text is never sent to a server.
- What algorithm does the comparison use?
- Google's diff-match-patch library. It performs character-level diffing, then applies semantic cleanup to group changes into readable hunks.
- Is this a line-based git-style diff?
- No. This tool compares at the character level, not line by line. There is no unified-diff output or file upload support.
- How are replacements shown?
- Replacements appear as a deletion (strikethrough) next to an insertion (highlighted). There is no single "changed" color.
- Does comparison normalize Unicode characters?
- No. NFC é (U+00E9) and NFD e + combining acute (U+0301) are treated as different characters. Use the Unicode normalizer first if you need them to match.