Skip to content

Code Diff Viewer

Compare two files side by side and export a unified diff.

Quick Tool Overview

The Code Diff Viewer uses Myers’ algorithm — the one Git uses — so two nearly identical files of several thousand lines compare almost instantly, where the usual longest-common-subsequence table would need memory proportional to their product.

What it does
Compares two blocks of code line by line
You give it
An original and a changed version
You get back
A marked-up comparison and a unified diff
Best for
Reviewing a change without a repository
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the Code Diff Viewer

Paste two versions and see exactly what changed: line by line, with the changed words picked out inside a modified line, and a unified diff ready to copy or save as a patch file.

The comparison uses Myers’ algorithm — the one Git itself uses — rather than a longest-common-subsequence table. The table approach needs memory proportional to the product of the two line counts, which is fine for a snippet and hopeless for two files of a few thousand lines each, which is exactly the size people paste. Myers is proportional to the number of differences instead, so two nearly identical large files compare almost instantly. Everything runs in your browser: nothing is uploaded, which matters when the thing you are diffing is a config file with credentials in it.

Key features of the Code Diff Viewer

The algorithm Git uses

Proportional to the number of differences rather than the size of the files, so pasting two large versions does not hang the tab.

Word-level highlighting

A one-word edit inside a line is shown as a one-word edit, rather than as a whole line removed and another added.

A real unified diff

Proper @@ hunk headers and context lines, so the output is a patch file rather than a picture of one.

Whitespace options

Ignore all of it, or just trailing — the fastest way to find a real change buried under a reformat.

Nothing uploaded

Which is the point when the file you are comparing holds credentials or customer data.

How to use the Code Diff Viewer

  1. 1

    Paste the original

    On the left — any code or text.

  2. 2

    Paste the changed version

    On the right.

  3. 3

    Read the difference

    Removed lines in red, added in green, with changed words highlighted within a line.

  4. 4

    Take the patch

    Switch to the unified diff and copy it, or download it as a .patch file.

Frequently asked questions

No. The comparison runs entirely in your browser — nothing is sent to a server, which is the point when the file you are comparing holds credentials or customer data.

Reviews of the Code Diff Viewer

What people who use the Code Diff Viewer think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Code Diff Viewer. It takes half a minute and no account.

Write the first review

More developer tools