DEVELOPER & DATA

Text Diff & Compare

Compare two texts line by line, by word or by character: added, removed and unchanged counts, a similarity score and a unified diff — all in your browser.

A side-by-side view of what changed between two versions with line numbers, the exact number of additions and removals, a similarity percentage, and a unified diff you can copy or download.

Example: Two config files that differ in three lines: 3 removed, 4 added, 4 unchanged, 53.3 % similar — with a unified diff ready for review.

v0.1.0 · last reviewed 18 September 2026
Loading the workspace…
BUILT TO BE UNDERSTOOD

The fewest edits,
shown in full.

How two texts are aligned, what the counts and the similarity figure mean, what the unified diff is for, and where a shortest edit script can surprise you.

The algorithm

Both texts are split into tokens — lines, words or characters — and compared with Myers' shortest-edit-script algorithm (1986), the same idea behind diff and Git. It finds the smallest number of insertions and deletions that turn the original into the changed text; everything it does not touch is the longest common subsequence. The common start and end are trimmed first so a small change in a large file costs almost nothing.

The numbers

Added and removed are token counts from the script; unchanged is the common subsequence. Similarity is 2 × unchanged ÷ (length of A + length of B), so identical texts score 100 % and texts with nothing in common 0 %. A line edited in place counts as one removed and one added — the tool does not guess that they are "the same line, modified", though the view places them together.

Ignore whitespace, ignore case, and the unified diff

With the ignore options on, tokens are compared after collapsing whitespace runs or lower-casing, but the text shown is always the original; a line that differs only in those ways is listed as unchanged with both versions. In line mode the unified diff (three lines of context, @@ -a,n +b,m @@ hunks) can be copied into a review or applied with patch.

What the number does not settle

A shortest script is not unique: other alignments with the same edit count exist, and a moved block always appears as a deletion plus an insertion. Very large differences (over 4,000 edits between the common start and end) are shown as one removed and one added block, and the page says so. Inputs up to 2 MB each are compared on your own machine; nothing is uploaded. The same four anonymous usage counts as the rest of the site apply.

SOURCES

Last reviewed 18 September 2026. How results are checked: How we verify.