Skip to content

Patch Apply

Apply a unified diff to a text and get the patched result. Paste the original text and a patch in the format of diff -u or git diff, and every hunk is applied in place. A fuzz setting lets the patch apply even when a few context lines have changed.

Reset

Frequently asked questions

Which patch formats are accepted?

Unified diffs, as written by diff -u, git diff and the Unified Diff Generator. File header lines such as --- and +++ and the git diff and index lines are read and ignored; the hunks starting with @@ do the work.

Can a patch change several files?

No. The tool applies a patch to one text, so the patch must describe a single file. If it contains changes for several files, the message says how many, and you can paste the part for the file you need.

What does the fuzz setting do?

It sets how many context lines of a hunk may differ from the text, from 0 to 3. With 0, every context line must match exactly. A higher value helps when the text has changed slightly since the patch was made; lines right next to a change must still match.

Why does my patch not apply?

The lines a hunk removes or keeps as context must be found in the text. If the text has changed in those places, or the patch was made against another version, the hunk cannot be placed. Try a fuzz of 1 or 2, or make the patch again.

Does it handle Windows line endings?

Yes. If the text uses CRLF line endings and the patch uses LF, or the other way round, the line endings are matched so the patch still applies.

Is the result checked?

A patch is applied all or nothing: if any hunk cannot be placed, no partial result is returned. Otherwise you get the complete patched text.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.