Text diff

Compare two texts online and see the differences

Paste the original on one side and the new version on the other. You will see which lines were added, removed or changed — and inside the changed ones, exactly which word — with aligned line numbers and navigation between differences.

Zero uploads · all in your browser

Your texts and your files never leave your device: they are compared right here.

Why it matters that none of this is uploaded

What people paste into a text comparer is rarely public: a contract before signing it, two versions of a production configuration with credentials inside, the draft of an announcement that has not gone out, or someone else's text and its edit. Sending both versions to some random website's server to be told how they differ means handing over both. Here there is nowhere to send them: the comparison is computed in your tab.

How it works, in 3 steps

  1. Put in both versions

    Paste the original on the left and the new version on the right. Or drag two text files onto it: drop both at once and each goes to a side.

  2. Read the summary, jump between changes

    At the top you get how many lines were added, removed and changed. The arrows take you from one difference to the next without hunting for it.

  3. Take it with you

    Switch to the unified view if you prefer a single column, or download the patch with only the stretches that changed.

What people use it for

By word, not just by line

Nearly every comparer tells you which lines changed. For code that is enough, because lines are short. For ordinary prose it is not: a forty-word paragraph is a single line, and having the whole thing highlighted in yellow tells you nothing. You end up reading it twice looking for the word that moved.

Here, when a line exists in both versions but has changed, it is compared from the inside, word by word, and only the parts that moved are highlighted: red for what it used to say, green for what it says now. If "12,000 dollars" became "14,500 dollars", that is what lights up and the rest of the sentence stays quiet. Punctuation counts on its own, so removing a comma marks the comma and not the word next to it.

Lining up is half the job

The hard part of comparing two texts is not painting colours: it is knowing which line of the original corresponds to which line of the new version. If you insert a paragraph on page 2, a naive comparer — one that goes line 1 against line 1, line 2 against line 2 — will mark everything after that as different, even though not a comma was touched.

This tool uses the Myers algorithm, the same one git and the diff command use, which finds the correspondence with the fewest possible changes. Inserting a paragraph reads as one inserted paragraph, and that is it. The implementation is checked against diff itself on three hundred randomly generated pairs of texts, requiring exactly the same number of added and removed lines.

The three options that kill false positives

Most of the differences nobody cares about come from three places. Ignore case is for comparing a text before and after a reformat. Ignore leading and trailing spaces gets indentation and stray end-of-line spaces out of the way — invisible things that appear the moment two people edit the same file in different editors. Ignore blank lines handles text pasted with double line breaks between paragraphs against text with single ones.

All three change what counts as the same, never what you are shown: lines still appear exactly as you wrote them, with their real numbering.

The trailing newline, which catches everybody out

There is one case that costs whole afternoons: two files that look identical on screen, but one ends with a line break and the other does not. To any program they are two different files, and plenty of online comparers cheerfully report them as the same. Here it is detected and stated in those words, because it is exactly the kind of difference you would never find by looking.

The limits, stated before they bite

For dropped files, the cap is 2 MB per side. A text of several thousand lines with a handful of changes compares in milliseconds, because the first thing the algorithm does is trim the matching beginning and end. What is genuinely expensive is comparing two enormous texts with nothing in common: there the work grows with the number of differences rather than the size, and if it goes past the limit you are told instead of left with a frozen tab.

Long unchanged stretches are collapsed behind a button, so a file of thousands of lines with three changes reads at a glance. And if what you have is two JSON files and you want to compare them properly, format them first: with the same indentation, the real differences jump out instead of hiding behind two different ways of writing the same thing.

Frequently asked questions

Are my texts uploaded to a server?

No. The whole comparison happens inside your browser: what you paste and the files you drop are processed on your machine and never leave the tab. No accounts, no database.

It matters more here than in almost any other tool, because what people compare is usually a contract before signing it, a production configuration, or unpublished text. Load the page, disconnect from the internet and check: it still works exactly the same.

Can I compare two PDFs or two Word documents?

Not directly. This tool compares text, and a PDF or a .docx is a compressed archive with formatting inside: dropping one in would produce meaningless characters, and when that happens we warn you instead of showing garbage.

The practical route is to open each document, select all, copy, and paste each version into one side. You lose the formatting, which does not matter for comparing content: what you want is which sentence changed.

What is the difference between side by side and unified?

Side by side shows the original on the left and the new version on the right, each line facing its counterpart. It is the more comfortable one for reviewing a contract: you can read both versions in parallel.

Unified merges both versions into one column, with a minus in front of what was removed and a plus in front of what was added. It is what version control tools use, it fits narrow screens, and it matches the patch you download.

What is the patch for?

It is a file in unified patch format, the same one diff and git produce. It carries only the stretches that changed, with three lines of context around each.

Use it to email or attach to an issue only what changed, and to apply it over the original with patch or git apply to get the new version. The one this tool produces has been verified by actually applying it, not just by reading it.

Why does it mark two lines as different when they look the same?

Almost always invisible whitespace: one extra space at the end of a line, a tab where spaces used to be, a double space in the middle. The first two are covered by the option to ignore leading and trailing spaces.

It can also be capitalisation, which has its own checkbox. And one case catches a lot of people out: one file ending with a line break and the other not. It looks identical, and to any program they are two different files; here it is detected and stated.

How long can the texts be?

For dropped files, 2 MB per side. Several thousand lines with a handful of changes compare in milliseconds, because the algorithm starts by trimming the matching beginning and end.

What is expensive is comparing two enormous texts with nothing in common: the work grows with the number of differences, not the size. If it goes past the limit, you are told instead of left waiting.

What do the colours mean?

The usual code: green added, red removed, amber for lines present in both but changed. Inside an amber line the specific words are highlighted more strongly.

Side by side, when a line only exists on one side, the gap on the other is striped: that way it is clear nothing is missing there, there simply is no line.

Which algorithm lines up the lines?

Myers, the one git and diff use. It shows exactly when it matters: insert a paragraph in the middle and a naive comparer marks everything after it as different; Myers finds the minimal correspondence and marks only the new paragraph.

This page's implementation is checked against diff itself on three hundred randomly generated pairs of texts.

Related tools