Code Diff Checker

Code Diff Checker

Compare two versions of code or text line by line and see exactly what was added, removed, or left unchanged.

Click Compare code to see the differences.

About the Code Diff Checker

The Code Diff Checker compares two blocks of code or text line by line and shows exactly what changed. Lines added in the new version are green, lines removed from the old version are red, and unchanged lines stay plain, so you can review a change at a glance instead of reading both versions from start to finish.

It is a diff online checker that uses a longest common subsequence method, the same idea behind git diff, to line up the matching lines between the two versions. That way a small change in the middle of a file does not throw off the rest of the comparison, and only the lines that really differ stand out.

The comparison is line by line, so a line with one changed word shows up as a removal followed by an addition, rather than a highlight inside the line. Everything runs in your browser, so the code you paste is never uploaded anywhere.

How to use

  1. Paste the original version in the Original code box and the new version in the New code box.
  2. Tick Ignore whitespace if differences in spaces or tabs should not count, or Ignore case if letter case should not count.
  3. Click Compare code, then read the summary counts for added, removed and unchanged lines.
  4. Switch between Unified view and Side by side to read the result in the layout you prefer.
  5. Use Copy result to copy the plain-text diff, Swap to reverse the two versions, or Clear to start over.

Key features

  • Line-by-line comparison with added, removed and unchanged lines colour-coded.
  • Unified and side-by-side views.
  • Ignore whitespace and ignore case options.
  • Summary counts for added, removed and unchanged lines.
  • Copy, swap and clear actions.
  • Works on any text, not only code.

Common uses

  • Compare code before and after a change to review it like a pull request.
  • Find the line that broke code that used to work by comparing the working version with the broken one.
  • Check config files across development, staging and production for unintended differences.
  • Compare two drafts of a document, list or contract to see what was edited.
  • Check what changed in generated code or in two API responses.

Frequently asked questions

How does the code diff work?

It lines the two versions up against each other with a longest common subsequence algorithm, then marks every line as added, removed or unchanged, using green for additions and red for removals.

What is the difference between unified and side-by-side view?

In unified view, both versions are merged into one list, with added lines marked by a plus and removed lines by a minus, the way git diff prints changes. Side by side puts the two versions in columns next to each other, so you can read the old line and the new line together.

Can I ignore whitespace differences?

Yes. Turn on Ignore whitespace and lines that differ only in spaces or tabs count as unchanged. This helps when code has only been reformatted and nothing else changed.

Can I ignore case differences?

Yes. Turn on Ignore case and upper and lower case letters count as the same. This helps with case-insensitive content such as SQL queries or config values.

Can I compare plain text as well as code?

Yes. The tool compares lines of any text, so it works for documents, lists, config files, logs and JSON as well as source code.

Does this tool save my code?

No. The comparison runs entirely in your browser, and your code is not uploaded or stored anywhere.

How do I compare two versions of code?

Paste the original version in the Original code box and the new version in the New code box, then click Compare code. The result shows added, removed and unchanged lines with summary counts.

Can I copy the diff result to share it?

Yes. Use Copy result to copy the plain-text diff, then paste it into a message, a document or a code review comment.

Can I swap the two versions around?

Yes. The Swap button reverses the original and the new version, which is handy if you pasted them in the wrong order and do not want to retype anything.

Why does one changed word show as a whole line removed and added?

Because the comparison works line by line, not word by word. A line with a single changed word counts as a removal of the old line followed by an addition of the new line, rather than a highlight inside the line.

Can I compare settings files from different environments?

Yes. The tool works on any text, so you can compare config files from development, staging and production to spot unintended differences before a release.

Free to use, no signup needed. This tool runs entirely in your browser — your data never leaves your device.