Reading the diff
- Red lines were removed from the original; green lines were added in the changed text.
- Inside a changed line, the exact words that differ are highlighted more strongly.
- Whitespace changes are made visible:
·for a space,→for a tab,⍽for a non-breaking space and¤for other invisible characters. - Long runs of unchanged lines are collapsed to 3 lines of context. Click to expand them.
- Click any line to jump to it in the input.
Switch between split view (side by side) and unified view (one column, like git diff). Turn on “only changes” to hide everything else.
Invisible differences it explains
When a line shows as changed but looks the same, one of these is usually to blame. Each is marked in the input it came from, with a one-click fix you can undo:
| Difference | Where it comes from |
|---|---|
| Line endings (CRLF vs LF) | Windows editors, Git’s core.autocrlf |
| No newline at end of file | Editors that don’t add a final line break |
| Trailing spaces | Editors and copy-paste |
| Tabs vs spaces | Different editor settings |
| Byte order mark | Some Windows editors saving as UTF-8 |
| Non-breaking and zero-width spaces | Web pages, Word, Slack, PDFs |
| Curly quotes and long dashes | Word processors and chat apps “smartening” text |
| Accents encoded differently | macOS file names, some databases (Unicode NFC vs NFD) |
| Look-alike letters from other alphabets | Cyrillic “а” and Greek “ο” in place of Latin letters |
Comparing structured data
Diffs work line by line, so two JSON files with the same data but different formatting will look completely different. Format both with the JSON formatter first, ideally with keys sorted, then compare. The same goes for minified code.
The command-line equivalent
diff -u original.txt changed.txt # unified diff
git diff --no-index a.txt b.txt # git's diff, outside a repo
git diff -w # ignore whitespace
git diff --word-diff # word by word
cat -A file.txt # show tabs (^I) and line ends ($)Checking whether two files are byte-for-byte identical? Compare their hashes with the hash generator.
Questions people ask
Why does the diff say lines changed when they look identical?
Can I ignore whitespace?
git diff -w. You can also ignore upper and lower case.Can I get the diff as a patch?
git diff and diff -u, with 3 lines of context. You can paste it into a code review or apply it with git apply or patch.