Code diff checker
Compare two versions of a source file and see exactly which lines and characters changed. Defaults to character-level precision with whitespace preserved, because in code an indentation change is a real change. Runs entirely in your browser, so proprietary source never leaves your machine.
Add text to both panels to see the differences appear here.
Working with source code diffs
A code diff answers one question: what changed between these two revisions? The engine here aligns the two files using a Myers difference algorithm, the same family of algorithm that powers version control diffs, so inserting a line near the top does not cascade into every line below it being reported as modified.
Choosing the right precision
Character precision is the default for code, because it isolates a renamed variable or a changed operator inside an otherwise identical line. Switch to line precision when you only care which lines were touched, such as when reviewing a generated file. Word precision sits between the two and is usually the better choice for comments and documentation blocks.
Handling reformatted files
When a formatter has run over one side, most of the reported differences are noise. Turning on Repeated whitespace and Leading / trailing spaces in the comparison settings collapses that noise so the genuine logic changes stand out.
Getting the result into your workflow
The unified diff export writes a conventional patch with three lines of context around each hunk, which you can apply with git apply, feed to patch, or paste into a review comment.
Code diff questions
How do I compare two versions of a code file online?
Paste the original source into the left panel and the modified source into the right panel. The tool aligns matching lines and marks inserted, deleted and edited lines, highlighting the exact characters that changed inside each edited line. You can also drag a source file onto either panel to load it.
Is it safe to paste proprietary source code into an online diff tool?
In this tool, yes. The comparison is performed by JavaScript running in your browser, and the source is never sent over the network or written to a server. That is not true of every online diff site, so if you are pasting code containing API keys, credentials or unreleased work, confirm the tool is client-side before using it.
Does the code diff preserve indentation and whitespace?
Yes. This mode deliberately leaves whitespace handling off, because in most languages indentation is meaningful and a change to it is a real change. If you want to ignore reformatting, turn on 'Repeated whitespace' or 'Leading / trailing spaces' in the comparison settings.
Can I export the result as a patch file?
Yes. The download-patch action produces a standard unified diff with three lines of context, the same format that git apply and the patch utility accept, so you can hand the result to other tooling or attach it to a code review.
Why are unchanged parts of my file hidden?
Long runs of identical lines are collapsed automatically so the changes stay close together and easy to scan, exactly as a code review interface does. Select the 'Show unchanged lines' bar to expand any collapsed section, or turn off 'Collapse unchanged sections' in the settings.