Unified diff applier

Apply or reverse a unified diff against a pasted file and see the result.

Runs in your browser. Your input is not uploaded.

Correctness last checked 2026-11-13. How we verify

Loading the tool…

What it does, how to use it, and questions

What it does

A unified diff lists removed lines with - and added lines with +, framed by --- / +++ headers and @@ hunks. patch and git apply read that format.

This page applies a single-file patch to pasted text, or reverses it, without needing a working tree.

How to use it

  1. Paste the original file.
  2. Paste the unified diff.
  3. Apply or reverse, then copy the result.

Things to watch for

  • If a hunk’s context does not match, the apply fails instead of guessing. Fix the source or regenerate the patch.
  • Binary patches and multi-file diffs that touch several paths are not supported here.

Questions

Where do I get a unified diff?
From git diff, diff -u, or Copy as unified diff on the text diff tool.
What does reverse do?
It applies the patch backwards, turning the new file into the old one when the hunks still match.
Why did apply fail?
A context line no longer matches. The source may already include the change, or line endings differ.
Is either side uploaded?
No. Both stay in this page.