Text AOriginal
Text BModified

Online Text Diff and Comparison Tool

Compare two blocks of text and highlight added, removed or changed lines. The diff viewer is useful for source code, configuration files, generated output, documentation, logs and any content where small differences matter.

For the clearest result, normalize irrelevant whitespace and line endings before comparing when formatting differences are not part of what you need to review.

Instructions

How to compare two texts

Paste the original text in Text A and the modified text in Text B, then click Compare. The tool analyzes both texts character by character and displays the result directly in the text boxes, marking differing snippets in red. To edit the texts again, click Edit.

Interpreting the result

Red characters in Text A represent what was removed or changed compared with Text B. Red characters in Text B represent what was added or replaced. Equal sequences of at least three consecutive characters return to the normal color, making it easier to identify where differences actually begin and end.

Differences section

Below the Compare button, only the list of differing snippets is shown, with A in red and B in green. Identical snippets do not appear in this section, making it easier to focus on changes when the texts are long.

What is a Text Diff

A diff is a representation of the differences between two versions of the same content. The name comes from the Unix diff command, created in the 1970s, which compares two files line by line and shows what was added, removed or kept. This output became known as a "unified diff" and is still used today by version control systems such as Git.

This tool uses the LCS (Longest Common Subsequence) algorithm to find the longest sequence of characters that appears in the same order in both texts. Everything outside that sequence is considered a difference. To avoid false positives caused by short coincidences, only sequences of three or more consecutive equal characters are treated as common snippets.