How diff works
A diff finds the smallest set of insertions and deletions that turns one sequence of lines into another. The classic algorithm (Myers, 1986, used by git and GNU diff) finds the longest common subsequence in time proportional to the number of differences, so comparing two near-identical large files is fast. This page runs it on lines first and then on characters within each changed pair, which is what makes a one-word edit show up as one highlighted word rather than two whole lines.
Reading a unified diff
--- old.txt
+++ new.txt
@@ -12,7 +12,8 @@
context line
-removed line
+added line
+another added line
context line The @@ header gives the line number and length of the hunk in each file. Lines starting with a space are unchanged context, - are only in the old file, + only in the new. patch -p0 < changes.patch applies it; git apply works too. The context lines let patch find the right place even if the file has shifted.
Options
Ignoring whitespace treats lines that differ only in spaces or tabs as equal, which hides reformatting noise and shows the real changes. Ignoring case does the same for capitalisation. The unified diff still shows the original lines; the options only affect which lines count as changed.
Limits
Everything runs in your browser; a few thousand lines compare in well under a second. Very large inputs (over about 2,000 lines on each side with many differences) are refused to keep the page responsive; for those, use diff or git diff --no-index a b locally.
Questions
How do I compare two files?
Open each in an editor, copy the contents into the two boxes. For files on a server, diff -u old new or git diff --no-index old new produce the same unified format without leaving the terminal.
What does the highlighting inside a line mean?
Within a pair of changed lines, the characters that differ are marked; unchanged characters are shown plain. It is a second diff run at character level on that pair.
Can it compare JSON or code?
Yes; it compares text. For JSON, pretty-print both sides first (the JSON formatter does that) so that each key lands on its own line and the diff shows real changes instead of one giant line.
Is my text uploaded?
No. The comparison runs in JavaScript in your browser. The site has no backend to receive it.