Skip to content

Code Diff Viewer

Compare two code versions line by line.

Runs in your browser · free · no sign-up

+0 −0

About the Code Diff Viewer

See exactly what changed between two versions of a file, like a pull request on GitHub. Choose side-by-side or unified view and optionally ignore whitespace changes.

Reviewing changes is a core part of programming: what did a colleague change in a config file, what is different between production and staging, which line in a long script was edited? Git shows diffs for files in a repository, but you often have two versions of something outside it: a pasted snippet, an exported config or a file from email. This viewer compares them line by line.

Paste the original on the left and the changed version on the right. Choose side-by-side view, which shows both versions aligned, or unified view, which shows removed and added lines in one column like git diff. Turn on Ignore whitespace to hide changes in indentation. Copy unified diff produces a patch in standard format that tools like git apply understand.

Unified diffs are the format used by git, patch files and code review tools. Copying the diff lets you paste it into a ticket or chat so others can see exactly what changed, or apply it to another copy of the file.

How to use the Code Diff Viewer

  1. 1Paste the original code on the left and the new code on the right.
  2. 2Choose side-by-side or unified view.
  3. 3Review the highlighted changes.

Key features

  • Side-by-side and unified views.
  • Line-level highlighting of additions and removals.
  • Ignore whitespace option.
  • Copy unified diff as a patch.
  • Runs entirely in the browser.

Practical uses

  • Comparing configuration between servers.
  • Reviewing a snippet before applying it.
  • Checking changes to a script received by email.
  • Teaching how diffs and patches work.

Example

Comparing two versions of a .env file shows the changed DATABASE_URL line in red on the left and green on the right, while unchanged lines stay neutral.

Tips and common mistakes

  • Use Ignore whitespace after reformatting code.
  • Format both versions with the same tool first to remove noise.
  • Use Text Compare for prose, where word-level differences matter more.

Limitations

  • Differences are shown per line; word-level highlights within lines are not shown.
  • Binary files cannot be compared.

Privacy

Both versions stay in your browser, which suits secrets and internal code.

Frequently asked questions

Is my code uploaded?

No. The comparison runs entirely in your browser.

Can I ignore indentation changes?

Yes, tick "Ignore whitespace".

Can I export a patch?

Yes. Click "Copy unified diff" to get a patch in standard diff format.

Can I compare JSON objects with different key order?

Sort keys in the JSON Formatter for both files first, then compare.

Can I compare very long files?

Yes. Thousands of lines compare quickly; extremely large files may take a moment.

Related tools

JavaScript MinifierMinify and compress JavaScript with Terser.
Code BeautifierFormat JavaScript, CSS, HTML and JSON.
Syntax HighlighterColorful code for blogs and docs.