Skip to content

DocumentsPublished About 1 min read

Standing tool on this site. The date is the catalog publish date. This page has no byline and no claimed reviewer. How this site is written.

Text diff

Compare two pastes line by line and mark lines that were removed from the left or added on the right.

The answer

A line that appears in both texts is unchanged. A line only on the left is removed. A line only on the right is added. The comparison is the whole line, not a character inside it.

Result

Line diff

  alpha
- beta
+ gamma

Lines only on the left

1

Lines only on the right

1

What do you want to do next?

How this works

Both texts are split on line breaks. A longest-common-subsequence pass keeps shared lines in order and reports the lines that are not shared.

The result marks an unchanged line with a leading space, a removal with a minus, and an addition with a plus. Each side is limited to 400 lines.

Practical steps

  1. 1

    Paste the older text on the left and the newer text on the right.

  2. 2

    Read minus lines as removals and plus lines as additions.

  3. 3

    If a single word changed, the whole line is reported as removed and added.

Examples

  • Left “alpha / beta”, right “alpha / gamma”

    alpha is unchanged, beta is removed, and gamma is added.

Common mistakes

  • ×

    Expecting a highlighted word when the tool is comparing whole lines.

Frequently asked questions

Does this ignore spaces?

No. A trailing space makes the line different.

Can I compare more than two texts?

No. This page compares one pair.

Continue reading