Text diff checker

Compare two pieces of text and instantly highlight every line and word that was added, removed or changed — all in your browser.

The differences will appear here once you compare.

What a text diff checker does, and how this one works

A diff tool answers a deceptively simple question: what exactly changed between these two versions? For a one-line edit you can see it by eye, but across hundreds of lines of code or several pages of prose the changes hide in plain sight. This checker reads both inputs, finds the parts they share, and then shows only the insertions and deletions needed to turn the original into the modified version.

Rather than comparing line 1 to line 1, line 2 to line 2 and so on — a naive approach where a single inserted line at the top makes everything below look changed — it computes the longest common subsequence (LCS). The LCS is the longest run of lines (or words) that appears in both texts in the same order. Everything inside the LCS is unchanged; everything outside it is an addition or a removal. This is the same family of algorithm that powers git diff and the classic Unix diff command.

A worked example

Suppose the original is alpha / beta / gamma (three lines) and the modified text is alpha / delta / gamma. The tool keeps alpha and gamma as the common subsequence, marks beta as removed () and delta as added (+). You get a clean, minimal description of the edit instead of three "changed" lines.

Choosing the right granularity

ModeHow it splits textBest for
Line by line Each line is one unit; line breaks are significant. Source code, JSON or YAML configs, logs, CSV data.
Word by word Splits on whitespace so edits inside a sentence are visible. Articles, essays, translations, legal contracts.

The two toggles refine this further. Ignore case treats Server and server as identical, and ignore whitespace stops stray leading or trailing spaces from registering as a change — handy when one file was reformatted by an editor.

Privacy note: this tool has no backend and runs entirely on your device. Your two snippets are compared in the browser tab in front of you and are never transmitted, logged or saved — close the tab and they are gone. Pasted markup such as <script> is escaped and shown as literal text, never executed.

Frequently asked questions

Is my text uploaded anywhere when I compare it?

No. The whole comparison runs in your browser with JavaScript — the two snippets are never sent to a server, logged, or stored. That makes it safe to diff confidential drafts, contracts, server logs or config files. You can even disconnect from the internet after the page loads and it still works.

How does this tool decide what counts as added or removed?

It computes the longest common subsequence (LCS) of the two inputs, then derives the shortest set of insertions and deletions that turns the original into the modified version. Because it aligns matching lines instead of comparing them position-by-position, a single inserted line near the top no longer marks everything below it as changed.

What is the difference between line mode and word mode?

Line mode treats each whole line as one unit — ideal for source code, configs and structured data where line breaks are meaningful. Word mode splits on whitespace so it can highlight edits inside a paragraph, which is better for prose, essays and contracts where the change is a few words within a sentence.

Does it ignore differences in whitespace or letter case?

By default it compares exactly, including spaces, tabs and capitalisation, so even a single trailing space shows up. Turn on "Ignore case" and "Ignore leading/trailing whitespace" to suppress those cosmetic differences when you only care about meaningful content changes.

Why are special characters like < and & shown correctly instead of breaking the page?

Every character from your text is HTML-escaped before it is rendered, so angle brackets, ampersands and quotes display literally as text. This both shows your content faithfully and prevents pasted markup or script tags from being interpreted by the browser.

Can I compare very large documents?

Yes, within reason. The diff runs comfortably on documents of a few thousand lines. Extremely large inputs (tens of thousands of lines) may take a moment because computing an exact LCS grows with the size of both inputs.