Diff Checker: Compare Text Online

Paste two versions of a text, code snippet or config file and see exactly what changed, line by line or word by word.

Paste the two versions to compare

Loading…

How to compare two texts

  1. Paste the earlier version into Original text and the newer one into Modified text, or use Open file under each box to load a text file. Sample texts are loaded so you can see a result straight away.
  2. The comparison runs as you type. For very large texts, press Compare to run it.
  3. Choose Line to highlight whole changed lines, or Word to also mark the changed words inside a line. Switch between Side by side and Unified view.
  4. Tick Ignore whitespace to skip differences in spaces and tabs, Ignore case to treat Hello and hello as equal, and Hide unchanged lines to show only the changes with three lines of context.
  5. Press Swap texts to reverse the direction, and Copy diff to copy the result as text with - for removed lines and + for added lines.

How the comparison works

The tool splits both texts into lines and finds the smallest set of added and removed lines that turns one into the other. It uses Myers' difference algorithm, the default method of git diff. Lines that sit in the same order in both texts are unchanged, and everything else is a deletion or an addition. In Word mode, each deleted line is paired with the added line next to it, and the same algorithm then runs on their words and punctuation to mark the exact edit.

Worked example

The default texts are a four-line invoice note and an edited five-line version. The summary reads "1 deletion, 2 additions, 3 unchanged lines".

Limits and edge cases

Frequently asked questions

How do I compare two text files online?

Open each file with the Open file button under the matching box, or paste their contents. The comparison happens in your browser and the text is not uploaded, so it works for private drafts and config files.

What do the red and green lines mean?

Red lines with a minus sign exist only in the original text. Green lines with a plus sign exist only in the modified text. Lines without a color are the same in both.

Can I ignore spaces or capitalization when comparing?

Yes. Tick Ignore whitespace to treat runs of spaces and tabs as equal and to ignore spaces at the start and end of a line. Tick Ignore case to treat upper and lower case letters as the same.

Why does a moved paragraph show as deleted and added?

A diff compares texts in order, so it cannot tell that a block moved. It reports the lines that disappeared from the old position and the lines that appeared in the new one.

Need to combine two versions into one? Use the text diff merger to accept or reject each change. To compare JSON, run both documents through the JSON formatter first so each key sits on its own line, and to tidy a list before comparing, try the line sorter.