Text Diff Checker

Line-by-line comparison of two versions, with additions and removals marked.

Reading two versions of the same text side by side is a task human eyes are bad at: identical paragraphs pull attention away from the one clause that changed. A diff does the comparison mechanically, marking every line that was added, removed or left untouched. This one runs in your browser, so contracts, drafts, configuration files and code can be compared without uploading either version anywhere.

How it works

1

Paste both versions

The original on the left, the changed text on the right.

2

Set the comparison rules

Indentation and letter case can be ignored if they are not what you are looking for.

3

Read the result

Removed lines in red, added lines in green, with line numbers from both sides.

How a diff decides what changed

A diff does not compare line 1 to line 1 and line 2 to line 2 — that would report everything after a single inserted line as changed. It searches instead for the longest common subsequence: the largest set of lines that appear in both versions in the same order. Whatever falls outside that set is the difference.

The consequence is that inserting a paragraph at the top costs one added line rather than rewriting the whole document, because everything below it still matches in order. This is what makes a diff readable, and it is why the algorithm is quadratic in the number of lines — every line of one side is weighed against every line of the other. That cost is the reason this tool caps each side at two thousand lines.

It also explains a behaviour that surprises people: a line that moved is reported as one removal and one addition, not as a move. From the algorithm’s point of view a relocated line has left one place and appeared in another, and there is no way to distinguish that from an unrelated deletion and insertion.

Why the comparison is line-based, and when to change the rules

Lines are the unit because they are where text is naturally structured — a paragraph, a config entry, a statement of code. A word-level diff produces a more precise picture inside a changed sentence but a far noisier one across a document, since reflowing a paragraph rewrites every line boundary and a word diff will happily report that as hundreds of tiny changes.

That reflow problem is worth planning for. If your original is one long unwrapped paragraph and your revision has hard-wrapped lines, a line diff will call the entire text changed, correctly but uselessly. Either compare like with like, or split both versions into one sentence per line before pasting.

The two options change what "identical" means. Ignoring leading and trailing whitespace hides indentation changes, which is right when comparing prose pasted from different editors and wrong when comparing Python or YAML, where indentation is syntax. Ignoring case is for comparing content, not code — SQL keywords and CSS selectors survive it, but variable names in most languages do not.

Frequently Asked Questions

Yes. The comparison is line-based, which suits source files, configuration and logs. Switch off "ignore leading and trailing spaces" for languages where indentation carries meaning, such as Python or YAML.
No. The comparison runs in JavaScript inside this tab. Neither version leaves your device, which is what makes the tool usable for contracts and unreleased drafts.
The algorithm matches lines by order, not identity. A line that appears in a different position is indistinguishable from one line removed and a different one added, so it is reported as both.
Two thousand lines per side. The comparison weighs every line of one version against every line of the other, so the work grows with the product of the two lengths rather than their sum.
Not currently. A changed line is shown as one removal and one addition, which keeps whole-document comparison readable at the cost of precision inside a single sentence.