How to compare two texts line by line

Text Diff compares two blocks of text line by line and shows both versions side by side, with line numbers and every added, removed or changed line marked in colour.

The comparison runs in this browser tab: your text is never uploaded, and there is no merge or replace button — the result is read-only, so copy anything you need out of the table.

  1. Paste the original version into the Basic text field and the revised version into the Comparative text field.
  2. Press Immediately compare.
  3. Read the table: unchanged lines are not marked, changed lines are orange, lines only in the original are red, lines only in the comparison text are green, and a grey cell means that version has no counterpart for the row.
  4. Edit a field and press Immediately compare again to rebuild the table, or press Clear to empty both fields and the result.
  5. Select and copy any lines you need from the table — the comparison itself is read-only.

How the comparison works

Line-based, not character-based

The tool compares whole lines and aligns the two versions so line numbers stay in sync. A single character edited inside a line marks that entire line; individual characters are not highlighted.

Because the comparison works on lines, CRLF and LF line endings do not create false differences: a Windows file and a Unix file with identical content compare as equal.

Reading the result

Each row shows the line number and the text for both versions. Orange marks a line that exists on both sides but differs; red marks lines that are only in the original; green marks lines that are only in the comparison text. A grey empty cell shows where the other version has no line.

Tabs are displayed as four spaces so indented code stays aligned, and long lines wrap inside their cell instead of stretching the page.

Practical limits

The comparison is case-sensitive: "Hello" and "hello" count as a change. There are no options to ignore case or whitespace, and no file upload — the text is pasted into the fields. If one field is empty, a short hint appears on it instead of a comparison.

Everything is computed in the browser. A few thousand lines compare in about a second on a normal machine, and no data leaves the page; for very large files a desktop diff tool is more comfortable.

Recent tools: