Diff Checker
Paste two versions of a file and see exactly what changed — added lines in green, removed lines in red. Everything runs locally in your browser.
What Is a Diff?
A diff is a line-by-line comparison between two versions of a text file. The name comes from the classic Unix diff utility, and the concept is at the heart of every version control system — Git's git diff, GitHub pull requests, and code reviews all display changes as diffs. Being able to read a diff quickly is one of the most practical skills a developer can build.
Common Uses
- Reviewing config changes — compare
nginx.conf,.env, or Docker Compose files before and after an edit. - Checking merge conflicts — paste the two conflicting versions to see exactly which lines differ.
- Verifying generated output — confirm a formatter or transpiler only changed what it should have.
- Debugging data exports — spot the row that changed between two CSV dumps.
- Checking API responses — paste the JSON or XML body from the same endpoint before and after a deploy to confirm only the fields you meant to touch actually moved.
How the Comparison Works
The tool splits both inputs into lines and finds the longest common subsequence (LCS) between them. Lines present in both versions are shown as context, lines only in the "Original" box are marked as removed, and lines only in the "Changed" box are marked as added. This is the same core algorithm behind the GNU diff tool, scaled down to run entirely in your browser — your text never leaves your device.
FAQ
- Q: Does this tool upload my code anywhere?
- No. All comparison happens locally in your browser with JavaScript — nothing is sent to a server. This makes it safe to paste proprietary source code or confidential configs.
- Q: Can it compare binary files or images?
- No — this tool works with text only. For binaries, use a dedicated binary diff tool or compare file hashes (e.g.
md5orsha256) to detect changes. - Q: How large can the inputs be?
- The comparison handles typical source files (up to a few thousand lines) instantly. Extremely large files may slow down the in-browser algorithm — for those, the command-line
difforgit diff --no-indexis a better fit. - Q: Why does the whole file show as changed when I only edited one line?
- Almost always line-ending mismatch: Windows files use CRLF (\r\n) while Unix/Mac use LF (\n). If the two versions use different line endings, every line counts as changed. Normalize both sides first — in VS Code click "CRLF" in the status bar and switch to "LF", or run
dos2unixon the file — then re-compare. Trailing whitespace differences can cause the same symptom. - Q: Can it ignore whitespace, indentation, or case differences?
- No — the comparison is exact: a line that gained one leading space or changed case counts as a changed line. That strictness is deliberate, since reformatted code and re-indented YAML are real changes you usually want to see. If you only care about content and not formatting, run both sides through a formatter (Prettier for JS/JSON,
yaml.dumpfor YAML) before pasting, so identical content renders identically. - Q: How do I do the same comparison in the terminal or in Git?
- For files on disk:
diff -u old.txt new.txtprints a unified diff. For two files that aren't in a repo:git diff --no-index old.txt new.txt(add--color-wordsfor word-level highlighting instead of line-level). For changes already committed:git diff HEAD~1orgit diff main..feature. The browser tool is handy when the text lives in chat, a log viewer, or a CMS and you don't want to save temp files first.
Why Use Our Diff Checker?
No signup, no file uploads, no server round-trips. Paste, compare, and copy the result — the color-coded output makes it obvious what changed at a glance, and the diff summary tells you how many lines were added and removed before you even scroll.