AltUtils

Text Diff

Compare two texts side by side or as a unified diff and highlight differences by line, word or character. Handles thousands of lines, privately and offline.

CategoryText Mastery
Sheet05 / 42
ProcessingIn your browser
Empty
Empty

What is the Text Diff Tool?

The Text Diff tool compares an original and a modified version of any text and shows exactly what was added, removed or left unchanged. Paste two versions (or open two local files), then choose whether to compare by line, by word or by character. Line mode works like a code review: changed lines are paired up and the edited words inside them are highlighted, in a side-by-side or unified layout, with long unchanged stretches collapsed to a few lines of context.

Under the hood it uses the Myers O(ND) difference algorithm — the same family of algorithm Git uses by default — which finds a shortest edit script between the two texts instead of naively comparing line 1 with line 1. Options let you ignore whitespace-only changes and differences in letter case. The result can be copied or downloaded as a standard unified diff (.diff) that tools such as patch understand, or, in word and character mode, as a [-removed-]{+added+} word diff.

Everything runs locally in your browser: neither the pasted text nor opened files are uploaded anywhere, so it is safe for contracts, configuration files and unpublished drafts.

Frequently asked questions

What is a text diff?
A diff (short for difference) lists the changes needed to turn one text into another. Here removed parts are shown in red with a minus sign or strikethrough, and added parts in green with a plus sign or underline, so the changes are readable even without colour.
Should I compare by line, word or character?
Use lines for code, configuration and lists — it matches how version control shows changes. Use words for prose, contracts and articles where a sentence was reworded. Use characters to spot tiny edits such as a changed digit, a typo or a replaced accent.
What does “Ignore whitespace changes” do?
It treats runs of spaces and tabs as a single space and ignores leading and trailing whitespace on each line, so re-indented code or double spaces are not reported as changes. “Ignore case” treats upper- and lower-case letters as equal.
How do I use the unified diff output?
“Copy unified diff” or the .diff download produces the standard format with ---/+++ headers and @@ hunks with three lines of context. You can paste it into a code review or ticket, or apply it to the original file with a command such as patch original.txt changes.diff.
How large can the texts be?
Several thousand lines compare in well under a second on a typical laptop, because the algorithm's cost grows with the number of differences rather than with the square of the text length. If two very large texts have almost nothing in common, part of the result is simplified to a block replacement so the page never freezes; the tool tells you when that happens.
Is my text uploaded or stored?
No. The comparison runs entirely in your browser's memory. Nothing is sent to a server and nothing is saved after you close the tab.