navaja.dev / diff

Text diff checker

Paste the original on the left and the changed version on the right to see every difference, down to the word. Works for code, config files, logs and plain text.

View
Whitespace

How to compare two texts

How it works

navaja diff uses the Myers algorithm, the same one behind git diff, to find the smallest set of lines to remove and add. Changed lines are then compared word by word. Line endings (CRLF or LF) are treated the same, and a missing newline at the end of a file is reported like git does.

Everything runs in your browser in a background worker, so big files stay responsive and nothing you paste is uploaded. Each side can be up to 5 MB.

Questions

Is my text uploaded anywhere?

No. The comparison runs entirely in your browser. Nothing you paste or open is sent to a server.

Can I compare two files?

Yes. Use Open file on each side or drop a file onto it. Any text file works: code, JSON, YAML, CSV, logs, Markdown.

How do I ignore whitespace differences?

Set Whitespace to Trailing to ignore spaces and tabs at the ends of lines, or to Ignore to skip all whitespace, including indentation. This is like git diff -w.

What is a unified diff?

The text format git and patch use: lines starting with - were removed, lines starting with + were added, and @@ headers give line numbers. Copy patch produces one you can apply with git apply.

Why does it say a line changed when it looks the same?

Usually trailing spaces, tabs versus spaces, or a missing newline at the end of the file. Switch Whitespace to Trailing or Ignore to hide those.

Can it compare JSON regardless of key order?

For JSON, use the Compare tab of the JSON validator: it compares the data itself, so reordered keys and formatting don't count as changes.