Diff Checker

Compare two versions of code or text and see exactly what changed. Added and removed lines are highlighted side by side or in a single unified view.

Updated
Runs in your browser. Your data is not uploaded.
Compare by
View

How to use the Diff Checker

  1. Paste the old version into Original and the new version into Changed, or upload a file into each.
  2. Pick Compare by lines, words, or characters, and tick Ignore whitespace or Ignore case if those differences don't matter.
  3. Press Compare. Removed text is red, added text is green, and the summary counts both. Switch View between side by side and unified.

How it works

The checker finds the longest common subsequence of the two inputs with the Myers diff algorithm, the same approach Git uses. Whatever isn't in the common part is either a removal from the original or an addition in the changed text.

  • Lines compares whole lines. Inside a changed line, the words that differ are highlighted too.
  • Words and Characters compare smaller pieces, which suits prose and single-line values.
  • Ignore whitespace treats runs of spaces and tabs as equal and ignores spaces at line ends. Ignore case treats A and a as the same.
  • The unified diff uses the standard ---, +++, and @@ hunk headers with 3 lines of context, so git apply and patch can read it.

Examples

Original:

host: localhost
port: 8080
debug: true

Changed:

host: localhost
port: 9090
debug: false
cache: redis

Result by lines: 2 lines removed, 3 lines added, 1 line unchanged. The unified diff is:

@@ -1,3 +1,4 @@
 host: localhost
-port: 8080
-debug: true
+port: 9090
+debug: false
+cache: redis

Limitations

  • Each side is limited to 2 MB. Very different inputs of that size can take a few seconds.
  • The comparison is textual. It doesn't know the syntax of your language, so moving a function shows up as one removal and one addition.
  • Binary files such as images and PDFs can't be compared.
  • Line endings are normalized, so a file saved with Windows CRLF and the same file with LF count as equal.

Frequently asked questions

Are my files uploaded to compare them?

No. Both texts are compared in your browser, and nothing is sent to a server.

What is a unified diff?

A text format that lists removed lines with -, added lines with +, and a few unchanged lines around them for context. Git, GitHub, and the patch command all use it.

Can I compare two JSON files?

Yes. Format both first with the JSON Formatter, ideally with sorted keys, so that differences in spacing or key order don't hide the real changes.

Why is a whole line marked as changed when only one letter differs?

Line mode compares whole lines. The changed words inside the line are highlighted more strongly, or you can switch Compare by to characters.

Often used together with the Diff Checker.

  • Regex Tester

    Highlights regex matches live, lists capture groups and offsets, and previews replacements.

  • JavaScript Formatter

    Beautifies minified or messy JavaScript with your chosen indent and brace style.