I copied the comparison result and it has lines starting with @@, + and -; how do I read it?

It is a standard format called a unified diff. A line starting with a minus exists only in the original text, a line starting with a plus exists only in the changed text, a line starting with a space is unchanged context, and the @@ line tells you which line numbers the section covers in each version. With a minute of explanation you can read it and pass it on to anyone.

Published · 3 min read

A short example

We compared a three-line price list, 'Coffee 50', 'Tea 20' and 'Dates 35', with a copy where coffee went up to 55. The plain-text result you copy or download reads like this, line by line:

  • Two header lines: '--- original' then '+++ changed'. The first stands for the original text, the second for the changed one.
  • The position line: '@@ -1,3 +1,3 @@'.
  • '-Coffee 50': the line as it was in the original.
  • '+Coffee 55': the line as it now is in the changed text.
  • ' Tea 20' and ' Dates 35', each starting with a space: context lines that did not change.

Decoding the @@ line

In '@@ -1,3 +1,3 @@' the part after the minus is about the original: the section starts at line 1 and covers 3 lines. The part after the plus is about the changed text: it also starts at line 1 and covers 3 lines. If the edit had added a new line, the second count would be larger than the first.

Long lists are not printed in full. You get the differences plus up to 3 context lines before and after each one, and the result splits into several sections, each with its own @@ line.

Worked example

A 12-item list where the first line changed (coffee from 50 to 55) and the last line changed (salt from 3 to 4).

Summary: Added 2, Removed 2, of which modified 2, Unchanged 10.

The plain-text result has two sections: '@@ -1,4 +1,4 @@' starts with the coffee change followed by three context lines, and '@@ -9,4 +9,4 @@' has three context lines then the salt change. Lines 5 to 8 are left out because they are far from any difference.

Why are the signs on the far left even for Arabic lines?

The plain-text result box is fixed left to right on purpose, so the signs always sit in the first column where software expects them. Arabic lines may look a little odd there, but the file itself is correct. The highlighted view above it shows every line in its own direction.

And for word or character comparison?

The format is different: no @@ lines, just the full changed text with removed parts wrapped in [- and -] and added parts in {+ and +}. For example, comparing 'Delivery in 3 days' with 'Delivery in 2 days' by words gives: Delivery in [-3-]{+2+} days.

Tips before you send it

  • If your colleague is a developer, send the text-diff.txt file as it is; version-control tools understand the format.
  • For someone non-technical, a screenshot of the highlighted view is clearer, or use word comparison so they see the whole text.
  • The download button saves every difference, even when only part of them is drawn on screen.

All of this is produced by Text comparison inside your browser, without uploading either text.

Common questions

Why is the result empty?

Because the texts are identical with the chosen settings, so there is nothing to write or download.

Do the words 'original' and 'changed' ever change?

No, they are fixed names for the two versions in the file header.

How many context lines are shown?

Up to 3 before and after each difference; sections that come close together merge into one.