Skip to content

Text diff

Paste two versions of a text or some code to see exactly what changed.

Compare

+3−2lines

1−The quick brown fox
1+The quick red fox
22jumps over the lazy dog.
3−It was a sunny day.
3+It was a sunny day,
4+and the dog slept on.
45The end.

How it works

Reading a diff

A diff lists what you would have to do to turn the original into the changed version. Lines marked + were added, lines marked − were removed, and an edited line shows up as one removed and one added line. The two number columns show where a line sits in the original and in the changed text.

Good to know

  • Moving a block of lines shows as removed in one place and added in another; a diff doesn’t track moves.
  • Invisible differences, such as trailing spaces or tabs instead of spaces, can make lines differ. Ignore whitespace hides changes in spacing. Windows and Unix line endings are treated the same.
  • For JSON, format both versions with the JSON formatter first, so formatting doesn’t hide the real changes.

Frequently asked questions

How does the comparison work?

It uses the Myers diff algorithm, the same one behind git diff: it finds the smallest set of lines (or words) to remove and add to turn the original into the changed text. Unchanged parts are shown in between for context.

When should I compare words instead of lines?

Lines suit code, configuration and lists, where each line stands on its own. Words suit prose, where one edited word would otherwise mark a whole paragraph as changed.

What do the ignore options do?

Ignore case treats "Fox" and "fox" as the same. Ignore whitespace treats lines as equal when they only differ in spaces, tabs or indentation, which helps after re-indenting code.

Is my text uploaded?

No. Both texts are compared in your browser and never leave your device, so it is safe for code and private documents.