How to compare code and export a unified patch
- Paste code into Original and Modified or use Choose a file under each input.
- Select Compare to see line numbers and inline changes.
- Switch Comparison view to Unified if you want a single sequence. Use Download patch for the original inputs.
Compare code side by side or in a unified diff
Use this code diff checker and diff checker to compare code from two versions of a script, configuration file or pull request without uploading proprietary source to a server. Put the baseline version in Original and the proposed revision in Modified. Dual line numbers help you jump straight to the edit in your editor. The side by side code compare view aligns matching blocks across two columns, while the unified view stacks removals and additions in a single top-to-bottom stream and highlights inline changes within modified lines.
Export a unified patch with exact line endings
Downloading a unified patch creates a standard .patch file (--- original, +++ modified, @@ hunks) ready for git apply or patch -p0. Uploading local UTF-8 files preserves their exact LF or CRLF line endings and trailing-newline state so the generated patch matches the source bytes on disk.
Format or compare related material
For prose documents and release notes, the text compare tool highlights word-level edits and can ignore case or whitespace. Use the SQL formatter to normalize query indentation before comparing database scripts, or run payloads through the JSON formatter before running a diff.
Frequently asked questions
Which input files work?
Choose one UTF-8 source file on each side. Each input can have up to 50,000 characters and 2,000 lines.
Which side goes first?
Put the older code in Original and the changed code in Modified. The patch describes how to turn the original into the modified version.
Does the patch keep line endings?
The patch uses the original strings, including the line endings of uploaded files and whether the last line ends with a newline.
Why can the line totals count a replacement twice?
A replacement contributes an old line to Lines removed and a new line to Lines added.
Can I compare a new or deleted file?
Yes. Leave the missing side empty and put the available code in the other field.
Last updated November 11, 2026