In short
- xdelta is an open-source tool by Joshua MacDonald for computing the differences between two files. xdelta3 is its current generation.
- xdelta3 writes patches in VCDIFF, a standard binary patch format described in RFC 3284.
- An XDelta patch holds instructions for rebuilding a file from an exact original, which makes it compact and well suited to large files.
- Delta Patcher is a graphical app with xdelta3 built in, so you don’t need the command line.
XDelta in one paragraph
XDelta is a delta encoding tool. Give it two versions of a file and it produces a small file, the delta or patch, describing how to turn the first into the second. Anyone with the first file and the patch can rebuild the second, byte for byte. The name “XDelta” gets used for the program (xdelta, now xdelta3), the patch files it creates, and informally the whole approach. When people say “an XDelta patch,” they mean a patch made by or compatible with xdelta3.
xdelta, xdelta3 and VCDIFF
| Term | What it is |
|---|---|
| xdelta | The original open-source differencing tool created by Joshua MacDonald. Older 1.x versions used their own patch format. |
| xdelta3 | The third-generation rewrite, and the version used today. It’s both a command-line program and a library other programs can build in. |
| VCDIFF | The standardized binary patch format xdelta3 reads and writes, published as RFC 3284. xdelta3 adds optional extensions such as secondary compression. |
| .xdelta file | A VCDIFF patch saved with the .xdelta extension. You’ll also see .vcdiff, .xdelta3 or .delta for the same format. |
| Delta Patcher | A graphical app that embeds the xdelta3 library, so it can apply and create these patches without the command-line tool. |
Every VCDIFF file starts with the same four bytes, D6 C3 C4 00: the letters “VCD” with the high bit set, followed by a version number. That signature is how xdelta3 recognizes a patch, and why it rejects other files with not a VCDIFF input.
What’s inside an XDelta patch
A patch doesn’t contain the new file. It contains a sequence of windows, and each window holds instructions for producing one chunk of the output:
| Instruction | Meaning | Example |
|---|---|---|
| COPY | Copy a range of bytes, either from the source file or from output already produced. | “Copy 4,096 bytes starting at byte 1,048,576 of the source.” |
| ADD | Insert new bytes stored in the patch. | “Add these 12 bytes of new text.” |
| RUN | Repeat a single byte many times. | “Write 2,048 zero bytes.” |
Alongside the instructions, xdelta3 can store an Adler-32 checksum for each window, so it can confirm the output is correct as it goes, plus an optional application header. Delta Patcher uses that header to store its patch descriptions. A worked example of how patches rebuild a file.
Why XDelta is popular for large files
- It handles inserted and moved data. COPY instructions can reference any position in the source, so data that shifted still becomes a cheap copy. Simpler formats like IPS can only overwrite bytes at fixed positions.
- It scales to big files. xdelta3 streams through files window by window, so multi-gigabyte disc images work. Delta Patcher supports files over 4 GB since version 3.1.5.
- It catches wrong source files. Per-window checksums stop the patch instead of producing a silently broken file.
- It compresses well. New data can be compressed, with secondary compressors like LZMA for extra savings.
- It’s open and cross-platform. The format is a published standard and the tools are open source.
The trade-off is strictness: an XDelta patch works only with the exact source file it was created from. How XDelta compares with IPS, UPS, BPS and PPF.
Tools that apply and create XDelta patches
- xdelta3 (command line): the reference tool, available from the xdelta project (opens external site) and many Linux package managers.
- Delta Patcher: a native desktop app for Windows, macOS and Linux with the xdelta3 library built in. It creates patches too. Download Delta Patcher.
- Browser-based patchers: some multi-format web patchers, such as Rom Patcher JS (opens external site), can apply VCDIFF/XDelta patches alongside other formats.
Delta Patcher vs the xdelta3 command line
| Delta Patcher | xdelta3 command line | |
|---|---|---|
| Interface | Graphical window with drag and drop | Terminal commands |
| Apply patches | Yes | Yes |
| Create patches | Yes | Yes |
| Choose output name and location | No. Saved next to the original, replacing it unless backup is on | Yes, any path |
| Patch descriptions | Writes and displays them (Patch info tooltip) | Can write raw application data; doesn’t display Delta Patcher descriptions |
| Compression and window options | Level 0–9, secondary compression, source window size, checksum | All of those, plus many advanced tuning flags |
| Scripting and batch jobs | No | Yes |
| Installation | Portable app for Windows, macOS, Linux | Separate binary; availability varies by platform |
For applying a patch someone gave you, Delta Patcher is simpler and harder to get wrong. For automation, or when you need to choose the output file name, use xdelta3.
Basic xdelta3 commands
If you do use the command line, these are the two commands you need. Quote paths containing spaces.
xdelta3 -d -s original.bin patch.xdelta patched.bin
xdelta3 -e -s original.bin modified.bin patch.xdelta
| Flag | Meaning |
|---|---|
-d | Decode: apply a patch. |
-e | Encode: create a patch. |
-s file | The source (original) file. |
-f | Overwrite the output file if it already exists. |
-n | Don’t write or verify checksums. Avoid this. |
-0 … -9 | Compression level when encoding. |
-S lzma|djw|fgk|none | Secondary compressor when encoding. |
-B bytes | Source window (buffer) size. |
Delta Patcher runs the same engine with the same options: applying passes -d, -f and -s, and turning off checksum validation adds -n.
Limitations to know about
- Exact source required. A different revision, region or dump won’t work. Why checksums fail.
- One file per patch. A patch maps one source file to one target file, so projects that change several files need several patches or a single container file.
- Compressed or encrypted data patches poorly. A small change can alter everything after it, which inflates patch size.
- Mixed tool support for extensions. Secondary compressors and application headers aren’t supported by every third-party patcher.