line · character · LCS-based

Compare two texts side by side

LCS-based diff with line and character granularity. Added / removed / unchanged ranges color-coded.

Text Diff Workspace
Original size
123 B
4 lines
Modified size
153 B
5 lines
Changes
3
+2 / −1
Status
Changed
line-level
Granularity
original · left
modified · right
unified diff
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.
Quick Start

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).

  1. 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 textlive
    input · 2 sidesloaded
    L: hello world
    R: hello brave world
    34 B · 2 linesside-by-side
  2. 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 diff and GNU diff behave.

    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 diff
    mode · granularityline / char
    + hello brave world
    - hello world
    1 add · 1 delLCS-based
  3. 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 script
    output · LCS diffcolor-coded
    + added
    - removed
      unchanged
    3 rowsminimal
  4. 04

    Export the diff

    Copy the result as unified-diff text (+ / - / prefixes), or download as .diff / .patch for piping into git apply or patch -p0.

    Everything happens locally — your sources never leave the browser. Open DevTools → Network to confirm zero outbound traffic.

    unified diff.patchgit applyprivacy-first
    export3 formats
    ✓ Copied unified diff
    ✓ Saved: diff.patch
    ✓ 100% client-side
    ready to shipsuccess
Pro tips

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.

Use Cases

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-correct

Document 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-clean

Snapshot 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 counts

Translation 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-friendly

Log 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-accurate

Code 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.

lossless
FAQ

Frequently asked questions

Longest Common Subsequence — the standard algorithm for line-by-line diffs (the basis of git diff, GNU diff, and most modern diff tools).
Line is best for code, logs, configs. Character shows fine-grained edits — typos, word swaps, style changes.
Tens of thousands of lines is fine. LCS is O(n*m) so very large pairs can be slow.
Unified diff style — but for git apply you typically need file headers. This output is the plain-text part.
No. All diffing runs locally.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!