Code Diff Checker
Compare two versions of code line by line: side-by-side or unified view with line numbers, ignore whitespace, case or blank lines, and copy the diff.
No differences: the two versions are the same.
Runs in your browser. What you enter is kept for 30 days to improve Toolgrid, then deleted.
How to use the Code Diff Checker
- 1 Paste the original code on the left and the changed code on the right.
- 2 Choose whether to ignore whitespace, case or blank lines.
- 3 Read the differences side by side or unified, and copy the diff if you need it.
About the Code Diff Checker
A diff shows what changed between two versions of a file: which lines were removed, which were added and which stayed the same. That is how code review works, but sometimes you need it outside version control, for example for two snippets from different servers, a config before and after, or code from an e-mail.
The checker compares line by line using a longest common subsequence algorithm, the same principle as diff and git diff. In side-by-side view, removed lines appear on the left next to the lines that replaced them on the right; the unified view shows one column with + and − markers, like a patch.
Ignoring whitespace is useful when only indentation changed, for example after re-formatting or when tabs became spaces. Ignoring blank lines hides changes that only add or remove empty lines. The download is a simple +/− list, not a full unified diff with @@ headers, so use git diff when you need to apply the result as a patch.
Frequently asked questions
Is this the same as git diff?
It uses the same idea (longest common subsequence) and shows the same kind of result. For patches that can be applied with git apply, use git diff itself.
Why is a moved block shown as removed and added?
A line diff only knows removed and added lines; moving a block means it disappears in one place and appears in another.
What does "ignore whitespace" do?
Lines are compared with all runs of spaces and tabs treated as one space and leading and trailing spaces ignored, so re-indented code counts as unchanged.
How large can the files be?
Tens of thousands of lines work. For very different large files the comparison falls back to showing the differing middle part as removed and added.