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.

Original
Modified

How it works

  1. Paste your texts. Put the original version in the left box and the modified version in the right box.
  2. Click Compare. The tool runs diff_main followed by diff_cleanupSemantic to find and group changes.
  3. 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.

AspectThis pageLine-based
GranularityCharacters after semantic cleanupWhole lines, then hunks
Librarydiff-match-patchgit diff; CPython difflib
Line modeNot used (no diff_linesToChars)Default for git and unified_diff
OutputInline HTML: strikethrough delete, highlight insertUnified ---/+++/@@ or ndiff prefixes
UnicodeNo normalize(); NFC ≠ NFDAlso raw unless you pre-normalize
InputTwo paste boxes; no file pathFile 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.

Related