Two texts. One exact edit script.

Myers diff with line, word & character granularity — inline highlights, 3-line context folding, zero upload.

granularity
Original
0 lines
Changed
0 lines
§ 01 — THE PROOF DESK

Built for version checks and change audits

The features you need when two versions of anything must be reconciled — code reviews, config audits, copy edits.

Myers Engine

The same O(ND) algorithm behind Git: the shortest edit script — minimal insertions and deletions, never a spurious change. 2,500-line configs diff in milliseconds.

Three Granularities

Lines for code and configs, words for Chinese copy (CJK split per character, English per word), chars for spelling — one engine, three token streams.

Context Folding

Every change ships with ±3 lines of surrounding context; untouched regions collapse into @@ bands you click to expand — long files stay readable.

Zero Upload

Normalization, diffing and rendering all run in your browser. Nothing is sent to any server — safe for source code, secrets in configs and unpublished copy.

§ 02 — HOW THE DESK READS

From raw paste to proven script

Three stages turn two texts into one auditable edit script — the same pipeline every serious diff tool runs.

i

Normalize

Both texts split on newlines into line matrices. Trailing whitespace is trimmed per line — indentation is preserved exactly, because indentation is meaning in YAML and Python. Case can be ignored for case-insensitive audits.

ii

Difference

The Myers algorithm walks an edit graph diagonally, greedily following the longest common subsequences. It provably returns the shortest edit script (SES) — the fewest deletions plus insertions that transform A into B — in O(ND) time, where D is the true difference size. Similar texts finish fast precisely because they are similar.

iii

Render

Adjacent delete and insert runs pair up as modifications, each diffed again at word level so the changed words glow inside the line. Unchanged regions fold into @@ context bands; everything maps into split or unified views with full line numbers.

fig. 1 — the edit graph: right edge deletes, down edge inserts, diagonals are free matches.
§ 03 — PROOF NOTES

Frequently Asked Questions

How do I compare two texts online?

Paste the original text on the left and the changed text on the right. The desk proofs them instantly as you type — every insertion, deletion and modification is highlighted with line numbers and counts. Press Ctrl+Enter (Cmd+Enter on Mac) to force a re-compare.

What is the difference between line, word and character mode?

Line mode diffs whole lines and is made for code and config files. Word mode tokenizes the text — Chinese characters individually, English words whole — and is ideal for copy review. Character mode diffs letter by letter, which catches spelling changes like licence vs license. All three run the same Myers algorithm on different token streams.

How does the diff algorithm work?

TextDiffHub uses the Myers diff algorithm: it finds the shortest edit script (SES) — the minimal sequence of insertions and deletions that turns text A into text B — in O(ND) time, where D is the size of the difference. Lines are normalized first (trailing spaces trimmed, indentation preserved, case optionally ignored), then matched into a longest common subsequence.

What does the @@ unchanged lines @@ band mean?

Unchanged regions farther than 3 lines from any change are folded into a context band, exactly like a unified patch hunk. Click the band to expand those lines and see the full file. This keeps long files readable — you see every change with enough surrounding context, without scrolling through untouched code.

Can it compare code files and configuration files?

Yes. Line mode preserves indentation and whitespace exactly as pasted, renders monospaced output with line numbers, and highlights the changed words inside modified lines — the same treatment Git gives a patch. YAML, JSON, INI, nginx configs, source code, logs and CSV all work; the comparison is purely textual, so any file you can paste is fair game.

Does it handle Chinese and other multilingual text?

Yes. Word mode splits CJK characters individually while keeping English words whole, so a Chinese copy edit highlights exactly the characters that changed, not the whole sentence. Character mode works for any Unicode text, including emoji.

What is the difference between split and unified view?

Split (side-by-side) shows the original on the left and the changed text on the right, aligned row by row — easiest for review. Unified shows a single patch stream where deleted lines appear with a minus sign and inserted lines with a plus — the format used by Git and patch files. Switch anytime; both share the same folding and inline highlights.

Is my text uploaded to a server?

No. The diff engine runs entirely in your browser with client-side JavaScript. Nothing you paste is transmitted, logged or stored — safe for source code, credentials in configs, and unpublished copy. Close the tab and everything is gone.

Latest Articles