Compare two texts side by side
LCS-based diff with line and character granularity. Added / removed / unchanged ranges color-coded.
Lorem ipsum dolor sit amet,consectetur adipiscing elit,sed do eiusmod tempor incididunt−ut labore et dolore magna aliqua.+ut labore et dolore magna aliqua,+exercitation ullamco laboris.
How to diff two texts
This tool computes an LCS-based (Longest Common Subsequence) diff between two strings. Switch between line-level (for code, logs, prose) and character-level (for fine-grained edits).
- 01
Paste both sides
Drop the original on the left and the modified version on the right — any text, any length. Both panes accept prose, code, configs, logs, JSON, or freshly-prettified output.
The diff runs as you type. Empty panes are tolerated; the algorithm only walks once both sides are populated.
originalmodifiedany textliveinput · 2 sidesloadedL: hello world R: hello brave world
34 B · 2 linesside-by-side - 02
Pick granularity
Line mode compares row-by-row — the right tool for source code, structured configs, server logs, and anything where whole-line additions matter. This mirrors how
git diffand GNUdiffbehave.Character mode reveals fine-grained edits — typos, word swaps, casing tweaks. Strikethrough on removals makes the before/after legible inside long sentences.
line modechar modeLCSMyers diffmode · granularityline / char+ hello brave world - hello world
1 add · 1 delLCS-based - 03
Read the colors
Green rows mark additions, red rows mark removals (with strikethrough in character mode), grey rows are unchanged context. The status pill in the stats bar flips between Identical, Changed, and Idle.
The Longest Common Subsequence (LCS) backbone guarantees a minimal edit script — no spurious moves, no churn-y false positives.
greenredcontextminimal edit scriptoutput · LCS diffcolor-coded+ added - removed unchanged
3 rowsminimal - 04
Export the diff
Copy the result as unified-diff text (
+/-/prefixes), or download as.diff/.patchfor piping intogit applyorpatch -p0.Everything happens locally — your sources never leave the browser. Open DevTools → Network to confirm zero outbound traffic.
unified diff.patchgit applyprivacy-firstexport3 formats✓ Copied unified diff ✓ Saved: diff.patch ✓ 100% client-side
ready to shipsuccess
Text-processing fundamentals worth knowing
Tokenise with Unicode classes
Use \p{L}\p{N} with the u flag so accents, ideographs, and emoji count properly.
Normalise line endings
Convert \r\n to \n before diffing or hashing — Windows-vs-Unix endings produce phantom changes.
Mind invisible characters
Zero-width joiners, BOMs, and non-breaking spaces look identical to ASCII space. Strip them before comparison or storage.
Stream don’t slurp
For multi-megabyte text, iterate line-by-line rather than loading everything to memory — keeps the tab responsive.
Choose collation deliberately
Default JS sort is code-point order, not human alphabetical. Use Intl.Collator for locale-aware sorting.
Re-run after normalisation
NFC vs NFD changes byte length but not visible glyphs. String.prototype.normalize() before counts and comparisons.
When to diff text
Anywhere two strings should match — or shouldn't.
Config drift
Compare two YAML/config dumps after JSON conversion. Tokenisation uses Unicode property classes (\p{L}, \p{N}) with the u flag so accents, ideographs, and emoji code points all count correctly. Surrogate-pair-aware counts mean 🚀 weighs 1, not 2.
Unicode-correctDocument review
See exactly what an editor changed in a draft. Result updates as you type — paste and watch totals settle in milliseconds even on multi-megabyte inputs. Heavy work runs through a memoised reducer so the editor never janks.
diff-cleanSnapshot tests
Diff expected vs actual snapshot strings. Output normalises line endings to LF for clean diffs across platforms. Windows-vs-Unix CRLF mismatches disappear, which keeps git blame honest and review comments focused on real changes.
instant countsTranslation review
Compare two translations of the same source. Code-point counts are stable across NFC/NFD normalisation. Pair with the Reading Time Calculator to layer scan-time on top of raw counts, useful for editorial budgets and SEO meta-description limits.
i18n-friendlyLog comparison
Compare yesterday's log line to today's to spot anomalies. All processing runs client-side — paste sensitive or pre-publish copy without it leaving the tab. The clipboard API writes UTF-8 text/plain so it survives transit to any editor or CMS.
code-point-accurateCode review
Quick standalone diff outside git when comparing snippets. Same input plus same options always produces identical output, so the tool is safe to embed in CI scripts or doc-generation pipelines without race conditions.
losslessFrequently asked questions
Something missing?
Tell us what you need. We ship the top requests every two weeks.