100% local — your data never leaves your browser

Text Diff — A Patch You Can Paste in a Ticket

Compare two texts line by line and get a unified diff, the same shape git prints, ready to paste into a ticket, a review or a chat message.

Instant Private Zero cookies

Original

Modified

Differences

What this tool does

Two texts in, a unified diff out.

version: 1          version: 2
name: demo          name: demo
port: 8080          port: 8080
                    debug: true
@@ -1,3 +1,4 @@
-version: 1
+version: 2
 name: demo
 port: 8080
+debug: true

The comparison uses the Myers algorithm — the one behind git diff — so the result is the shortest set of changes rather than the first one found. Identical texts give an empty result, which is the answer you wanted.

Reading the output

  • @@ -1,3 +1,4 @@ — where the change sits: three lines from line 1 on the left, four from line 1 on the right.
  • - — the line is in the first text and not in the second.
  • + — the line is in the second and not in the first.
  • A leading space — the line is unchanged, shown for context. Three lines of it on each side, as Git does by default.

When two identical-looking lines differ

-a
+a

Nothing to see, and yet they are not the same line. The usual suspects are a trailing space, a tab against spaces, and a Windows \r\n against a Unix \n — a file edited on two machines collects all three. The comparison reads the exact characters, so it reports a difference it cannot show you.

cat -A on Unix prints $ at the end of each line and ^M for a carriage return; most editors have a “show whitespace” switch. Either will make the difference visible in a second.

What it does not do

  • Word-level highlighting. One changed character marks the whole line.
  • Rename or move detection. A block moved elsewhere reads as a removal and an addition, not as a move.
  • A three-way merge. This compares two texts; it does not resolve them.
  • The \ No newline at end of file marker. A text that ends with a line break against one that does not shows as an added empty line, which is the same information in a plainer form.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

Two lines look identical but show as `-` and `+`. Why?
Because the difference is invisible. A trailing space, a tab where the other side has spaces, or a Windows line ending (`\r\n` against `\n`) all change the line without changing what you see. The comparison works on the exact characters, as Git does. To see them, run the text through `cat -A` on Unix, or turn on “show whitespace” in your editor.
What do the `@@` lines mean?
They locate the change: `@@ -1,3 +1,4 @@` means “from line 1, three lines on the left; from line 1, four lines on the right”. Below, a line starting with `-` was removed, `+` was added, and a space means unchanged — three lines of context are kept around each change, the same default Git uses.
Does it highlight the word that changed?
No — the comparison is line by line. Change one character and the whole line shows as removed and added again. That is what a unified diff is, and it is why the output pastes cleanly into a review tool; a word-level view is a different thing, and a different tool.

Related converters