Reviewing a code change without a repository
Git shows diffs between commits, but plenty of code never makes it into a repo in time: a snippet a colleague pasted into chat, a config file on a server, two versions of a script attached to a ticket. Paste both here to get the same kind of review view: line numbers on both sides, removed lines on the left, added lines on the right, and the changed tokens highlighted within each line.
The example above re-indents the function from 2 to 4 spaces. With Ignore whitespace on (the default here), only the three real changes show up. Untick it to see every re-indented line too.
Tips for cleaner code diffs
- Line mode is closest to
git diff. Switch to it when you want whole-line changes only. - Hide unchanged folds identical stretches down to 3 lines of context, like a pull request view. Click a fold to expand it.
- Minified files are one long line, so every change is "line 1". Format them first (Prettier, or your editor's formatter), then compare.
- For JSON or YAML config, the JSON compare and YAML compare ignore key order; for queries, SQL compare formats both sides first.
Questions
Which programming languages does code compare support?
All of them. The diff works on text, line by line, so JavaScript, Python, Java, C#, Go, SQL, config files and anything else plain-text compare equally well. There is no syntax highlighting, so the change highlighting stays easy to read.
How do I ignore indentation changes?
Tick "Ignore whitespace". Lines that differ only in spaces, tabs or trailing whitespace are then treated as unchanged, which is useful after re-indenting or switching tabs to spaces. Be careful with Python and YAML, where indentation changes meaning.
Can I compare two files instead of pasting?
Yes. Use Open file on each side, or drag two files onto the page at once. Files are read locally in your browser; nothing is uploaded. Files up to 20 MB and 1,000,000 characters per side are supported.
Can I turn the result into a patch?
Yes. Download .diff produces a unified diff with three lines of context, the same format as git diff. Apply it with git apply changes.diff or patch -p0 < changes.diff (adjust the file names inside the patch to match your paths).
Why does the diff show a moved function as deleted and re-added?
Line-based diff algorithms, including Myers (used by git), describe changes as insertions and deletions only. A moved block is therefore a deletion in one place and an insertion in another. Some tools add move detection as a separate pass; textdiff keeps the standard behaviour so the patch matches what git produces.