Skip to content
Orpheus

Compare Two Texts

Line-by-line differences, computed in your browser.

Options

Everything is processed in this tab. Nothing you paste is sent anywhere.

Every tool runs entirely in your browser. Your files are never uploaded to a server.

A diff finds the longest sequence of lines the two versions share, then reports everything else as added or removed. Lines prefixed with a minus are only in the first version, a plus only in the second.

How to use Text Diff

  1. Paste the original. The first version goes in the top box.
  2. Paste the changed version. The second goes in the box below it.
  3. Read the differences. Minus lines were removed, plus lines added, with counts beside them.

About comparing two texts

Comparing two versions of a text is one of those tasks that is trivially easy to describe and surprisingly involved to do well. The naive approach — walk both versions together and report the first mismatch — falls apart as soon as a line is inserted, because everything after it appears changed when nothing was. The standard solution is to find the longest common subsequence: the largest set of lines appearing in both versions in the same order. Whatever falls outside it is reported as removed from the first or added to the second, which produces the smallest sensible description of what happened rather than merely a correct one. This works on whole lines, which is the same granularity version control uses and is a deliberate trade. Changing a single word reports the line as removed and a replacement added, rather than highlighting the word. That is less precise but far easier to scan, and it avoids the noisy output that character-level comparison produces on ordinary prose. The whitespace option matters more than it sounds. Re-indented code, text copied out of a word processor and files that have travelled between operating systems routinely differ in ways that are invisible on screen, and comparing without trimming reports them all. Everything here runs in the browser, which is the practical point: contracts, credentials and unreleased source can be compared without being sent anywhere. Two versions go in two separate boxes, which is worth mentioning only because the obvious alternative is worse: putting both into one box with a marker line between them fails the moment the text itself contains that marker, and a line of three dashes is a YAML front-matter delimiter, a Markdown horizontal rule and an email signature separator. Splitting on it silently compared the wrong halves and discarded whatever came after the second one. Very large inputs are handled by stripping identical beginnings and endings before any alignment is attempted, which reduces the common case — a small edit inside a large document — to almost no work at all. Beyond a memory budget the comparison falls back to matching line against line and labels itself approximate, rather than allocating a table proportional to the product of the two lengths and taking the tab down with it.

Frequently asked questions

Is my text uploaded anywhere?
No. The comparison runs in your browser using JavaScript, so both versions stay on your machine. That matters for contracts, source code and anything else you would not paste into an unknown server.
Why does a small edit show as a whole line changed?
Because the comparison works on complete lines. Changing one word marks the line removed and a new one added, which is also how version control systems report it. It keeps the output stable and easy to scan.
What does ignoring whitespace do?
It trims spaces and tabs from the start and end of each line before comparing, so re-indented code or text pasted from a document with trailing spaces does not report differences that are invisible on screen.
How does the comparison decide what changed?
It computes the longest common subsequence of lines — the largest set that appears in both versions in the same order — and treats everything outside it as an addition or removal. That produces the smallest sensible set of changes rather than the first one found.
Is there a size limit?
The algorithm uses memory proportional to the two lengths multiplied together, so a few thousand lines each side is comfortable and much larger inputs will get slow. For files that size, a local diff tool is the better instrument.

Last updated