GrepBoardTools GrepBoard manuals ↗ Log ↗

Tools / Text & encoding

Compare two texts

Paste the original on the left and the changed text on the right — the result reads like diff -u.

What you type is calculated only in your browser and is not sent to a server.

🔒 Both texts stay in this browser.

What it does

It compares two texts line by line and shows removed (−) and added (+) lines. Side by side puts paired lines on the same row and highlights only the characters that changed; Unified looks like diff -u. The text from “Copy diff -u” can go straight into patch.

The comparison works like GNU diffutils (Myers minimal edit plus GNU's tie-breaking), so even when it is ambiguous which line to call changed — blank lines or repeated } in a config file — it picks the same lines as GNU diff -u.

Examples

Original / changedOptionResult
listen 80; / listen 80;noneone line changed
listen 80; / listen 80;-b or -wsame
server_name a; / Server_Name a;-isame
a b c / abc-b / -wdifferent / same — -b ignores the amount of white space, -w ignores all of it
no final newline / final newlinenonethe last line shows as changed with \ No newline at end of file

Options

  • Ignore all white space (-w): removes spaces, tabs, \r and so on before comparing. Lines whose only change is indentation disappear.
  • Ignore amount of white space (-b): ignores differences in run length and trailing white space only. a b and ab still differ.
  • Ignore case (-i): folds A–Z only, like GNU diff. Letters such as Ä/ä or É/é still differ.
  • Context lines: how many unchanged lines to show around each change (diff -U n). Changes separated by no more than twice that many unchanged lines share one hunk.

Lines treated as equal because of an option are printed from the original text in unified output, as GNU does.

How it was checked

Before publishing it was compared with the real GNU diffutils 3.10 diff -u (LC_ALL=C.UTF-8): 122 pairs × five option sets (none, -w, -b, -i, -i -w), 610 runs in all. The samples are nginx, sshd_config, docker compose YAML, package.json, an access log, JavaScript and Korean prose with random edits (delete, insert, change, move, duplicate lines), empty, identical, no-final-newline and no-break-space (U+00A0) cases, and 44 pairs full of repeated blank lines and } (four of them 3,000 lines long). In all 610 runs the removed and added lines matched, and the output without the two header lines (names and times) was identical character for character. Without options, the diff this tool made was also applied with the real patch and gave the changed text byte for byte.

Common mistakes

  • Missing a final-newline difference in pasted text — if only one side ends with a newline, the last line shows as changed (\ No newline at end of file).
  • Reading tabs vs. spaces as a content change — turn on -w to see whether only indentation differs.
  • Comparing text copied from a web page — trailing spaces and invisible no-break spaces (U+00A0) sneak in. U+00A0 is not ignored even with -w (GNU behaves the same).

FAQ

How do I get the same result on the command line?

diff -u original changed. Add options as they are: diff -u -w, diff -u -i. Change the context with diff -U 5. For word-level changes, git diff --no-index --word-diff original changed is handy.

Can it compare very long texts?

It stops when one side has more than 20,000 lines — a size where even the worst case (every line on both sides, heavily reordered) finishes in a few seconds in a browser. For more, use diff on your machine.

Are my texts sent to a server?

No. Both texts stay in this browser. They are not written to the address bar or browser storage and are not passed to this site's analytics or ads. Details are in the privacy notice.