Free Diff Viewer
Paste two versions of a file or a paragraph to see exactly what changed, as a patch, side by side, or word by word.
What is a Diff Viewer?
A diff shows what changed between two versions of a text: which lines were removed, which were added, and what stayed the same. This viewer compares two pastes and shows the changes as a unified diff, as two columns, or word by word.
Comparison uses jsdiff, a widely used JavaScript implementation of the Myers algorithm that git also uses by default. Unified mode writes a standard patch with three lines of context, the format of diff -u and git diff. Word mode marks changes inside lines, which suits prose and long configuration values.
Key Features
A Real Patch
Unified output has the --- and +++ headers and @@ hunk ranges that git apply and patch understand. Download it as a .diff file.
Side by Side When You Need It
Split view lines the two versions up in columns, with gaps where one side has lines the other lacks, which suits reviewing longer files.
Word-Level Changes
Word mode marks removed words in [-brackets-] and added words in braces with plus signs, like git’s word diff, so one changed number in a paragraph stands out.
Line Counts at a Glance
The stats show how many lines were added and removed, the same numbers git shows in a pull request.
Private by Design
Both texts are compared in your browser and never uploaded, so contracts, code and configs stay on your machine.
Perfect for everyone
- Developers comparing files or configs
- Writers and editors checking revisions
- Anyone who needs to know exactly what changed between two versions
How to Use the Diff Viewer
Paste both versions, pick a view, and read or download the changes.
Paste the Original
Put the older or reference version in the first box. Line endings from Windows and Mac are normalized, so they don’t show as changes.
Paste the Changed Version
Put the newer version in the second box. The diff updates as you type in either box.
Choose a View
Unified suits code and patches, Side by side suits longer files, and Words suits prose or single-line values where a few words changed.
Copy or Download
Copy the result into a ticket or review, or download the unified diff as a .diff file to apply with git apply.
Changes, Diffed
Each example is the original text, three dashes, then the changed text. The answer is the viewer’s output in the mode on the chip, so picture the plus and minus lines before revealing it.
“port: 8080 timeout: 30s retries: 3 --- port: 8080 timeout: 60s retries: 3”
“alpha beta --- alpha beta gamma”
“import os import sys import json --- import os import json”
“name = "app" version = "1.0" --- name = "app" version = "1.0"”
“line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 --- LINE 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 LINE 10”
“same text --- same text”
“last line --- last line ”
“Refunds are issued within 14 days of the request. --- Refunds are issued within 30 days of the request.”
“const total = price * qty; --- const total = price * qty * (1 + taxRate);”
“The meeting is on Monday at 10. --- The call is on Tuesday at 10.”
How to Read Unified Diff Output
Unified diffs look cryptic at first, but every line follows a small set of rules. These ten cover the whole format.
The --- and +++ Headers
The first two lines name the old and new files. In git output they’re prefixed a/ and b/.
“Which header names the new file?”
Hunk Headers
A line like @@ -1,3 +1,4 @@ starts a hunk: the old text from line 1 for 3 lines, the new text from line 1 for 4 lines.
“In @@ -12,5 +12,6 @@, how many lines does the new side cover?”
Minus Lines Were Removed
A line starting with - exists only in the original. A changed line shows as a minus line followed by a plus line.
“Where does a - line exist?”
Plus Lines Were Added
A line starting with + exists only in the changed version. Lines added at the end of a file appear after the last context line.
“Where does a + line exist?”
Space Lines Are Context
Lines starting with a space are unchanged and show where the change sits. Three lines of context on each side is the default.
“How many context lines does git show by default?”
Separate Hunks for Distant Changes
Changes more than six unchanged lines apart get their own hunks, because their context doesn’t overlap.
“Why does one diff have two @@ lines?”
No Newline at End of File
A backslash line saying there’s no newline at end of file marks a last line without a line break. Editors that add one create this change.
“What does the backslash line mean?”
Whitespace Counts
A trailing space or a tab instead of spaces makes a line different, even though it looks the same. The minus and plus lines will look identical.
“Can two lines look the same but differ?”
Word Diff Markers
In word mode, removed text sits inside [- and -], and added text inside braces with plus signs. Unchanged text has no markers.
“How is a removed word marked?”
Applying a Patch
A unified diff can be applied with git apply or patch -p0. The context lines must match the target file for it to apply cleanly.
“Which command applies a .diff file in a git repository?”
Choosing a Diff View
Each view answers a slightly different question about the same change.
Unified for Code Review
The compact format code review tools and email patches use. It shows each change with just enough context.
Side by Side for Long Files
Two columns make it easy to keep your place when many lines changed, as in a rewritten config or a translated document.
Words for Prose
When one word in a long sentence changed, line diffs show the whole sentence twice. Word mode shows just the changed words.
Words for Long Lines
Minified JSON, CSV rows and single-line configs change inside the line. Word mode finds the changed value.
Unified for Sharing
A .diff file can be attached to a ticket and applied later, which a screenshot of a side-by-side view can’t.
Any View for a Quick Check
Pasting two versions to confirm they’re identical takes a second. The viewer says so outright when nothing changed.
Diffing Mistakes
These make a diff look bigger, smaller or stranger than the real change.
Reformatting Before Comparing
If one version was reformatted, every line looks changed. Run both through the same formatter first.
Invisible Whitespace
Trailing spaces and tabs make identical-looking lines differ. Strip trailing whitespace in your editor if they don’t matter.
Swapping the Boxes
Pasting the new version first inverts every plus and minus. Original goes on top, changed below.
Comparing Minified Files Line by Line
A minified file is one long line, so a line diff only says it changed. Use word mode, or format the file first.
Missing Final Newlines
Editors disagree about ending files with a newline, which produces a change on the last line. Settle it in an .editorconfig.
Line Ending Noise
Windows CRLF and Unix LF endings make whole files differ in some tools. This viewer normalizes them, but git may not without a .gitattributes rule.
Moved Blocks
A block moved elsewhere shows as removed in one place and added in another. Look for matching minus and plus runs.
Diffing Secrets in Shared Tools
Pasting credentials into an online diff that uploads them is a leak. This one runs locally, but redact keys anyway when sharing the result.
The Same Views in git
Each view here has a git equivalent for when the files are already in a repository.
git diff
Prints a unified diff of unstaged changes against the index. Add --staged to see what the next commit will contain.
git diff --word-diff
Marks changed words inline, in the same [- -] and plus-brace style as Words mode. Add =color for colours instead of markers.
git diff --stat
Lists each file with a count of added and removed lines, like the stats under the diff here.
git diff -U10
Shows ten lines of context instead of three, which helps when a hunk is hard to place.
git diff --ignore-space-change
Treats runs of spaces as equal, hiding indentation-only changes. Use -w to ignore all whitespace.
git diff --no-index
Compares any two files on disk, even outside a repository, with all of git’s diff options.
When to Reach for a Diff
Any time two versions exist and you need to know exactly how they differ.
Comparing Config Files
Find the setting that differs between a working and a broken server, down to a changed timeout.
Reviewing a Document Revision
See what a colleague changed in a contract, policy or article, word by word, without track changes.
Checking Generated Output
Compare output from two versions of a script or build to confirm a refactor changed nothing.
Creating a Patch Without git
Diff two versions and download a .diff to send to someone who applies it with patch.
Comparing API Responses
Paste formatted JSON from two environments to spot the field that differs.
Proofreading Edits
Check that an editor changed only what they said they did, with word mode highlighting every edit.
Teaching Diff Syntax
Show how hunks, context and plus and minus lines work with small, editable examples.