diff Online

Get the exact output of the diff command for two texts or files, download it as a patch, and copy the matching command.

Runs in your browser. Nothing is uploaded.

Updated

Two filesRuns in your browser · GNU diff output
Run it in your terminal
diff -u original.txt changed.txt
Your text stays on this device. No upload required.

How to use diff Online

  1. Paste or open the original and the changed file.
  2. Pick unified, context or normal output and any flags.
  3. Copy the output or download it as a .patch file.

diff Online at a glance

Typical use: Create a unified .patch file for a config change and attach it to a bug report.

Matches GNU diff output. Files up to 10 MB each are read on your device and never uploaded.

When to use diff Online

Get the exact output of the diff command without a terminal: a unified diff to attach to a bug report or apply with patch, a context diff, or diff's classic default format. The output matches GNU diff, the version on Linux, and the matching command is shown under the result.

Everything runs in your browser; files you open are read on your device and never uploaded. For a coloured side-by-side view, use Compare Text.

Output formats

FormatLooks likeUse it for
Unified -u@@ -2,3 +2,4 @@, lines starting with - and +Patches, code review, git; the most common format
Context -c*** 1,5 ****, lines marked !, -, +Older patch workflows and some mailing lists
Normal2c2, < old, > newQuick reading; scripts that expect plain diff

diff Online examples

  • Make a patch: choose Unified, click Download .patch, then apply it with patch -p0 < changes.patch or git apply changes.patch.
  • Ignore re-indentation: tick -w so only real content changes appear.
  • Smaller hunks: set context lines to 0 or 1 to show only the changed lines.

References

Frequently asked questions

Is the output the same as the diff command?

Yes, for GNU diff (Linux). Our tests compare it with real GNU diff output in all three formats, including the ignore options and missing final newlines. File headers show the file names without timestamps, like diff --label.

Are my files uploaded?

No. Files are read on your device and compared in your browser.

What is the difference between -b and -w?

-b ignores changes in the amount of spacing (two spaces versus one, trailing spaces). -w ignores all spaces and tabs, so "a b" and "ab" count as the same.

Why does diff on my Mac look different?

Recent macOS versions ship a different diff implementation. The formats are the same, but small details can differ. Install GNU diffutils with Homebrew (brew install diffutils) for identical output.

What does "\ No newline at end of file" mean?

The last line of that file has no line break after it. diff marks it so that applying the patch keeps the file exactly as it was.