Compare two pieces of text or code and instantly see what changed. Highlight additions, deletions and unchanged content with side-by-side and unified diff views.
TWO FILES
CHANGES
Original
Loading editor…
Modified
Loading editor…
Ignore options
Comparison summary
Enter text in both fields to compare the differences.
Everything runs locally in your browser. Your text and code are not uploaded to our server — the comparison, the merge and the download all happen on your device.
What is a diff checker?
A diff checker compares two versions of text or code and shows what changed: which lines were added, which were removed, and which are the same in both. It is the same idea as git diff or the file view in a pull request, applied to two blocks of text you paste in yourself.
The value is in what it removes. Reading two versions side by side and spotting the differences by eye is slow, and it is unreliable in exactly the case that matters — a single changed character in the middle of a file that otherwise looks identical.
Two versions, and what a diff says about them
1Original Modified2─────────────────────────────────────────────────3const name = "John"; const name = "John";4const age = 30; const age = 31;5console.log(name); console.log(name);67→ 1 addition, 1 deletion, 1 changed section
How does a diff tool work?
The pipeline is short and the interesting part is the middle step.
From two documents to a list of changes
1Original ──┐2 ├──▶ split into lines ──▶ find the longest3Modified ──┘ common subsequence4 │5 ▼6 in both ──▶ unchanged7 left only ──▶ removed (−)8 right only ──▶ added (+)
Both versions are split into lines, and the algorithm finds the longest sequence of lines that appears in both, in order. Whatever is in that sequence is unchanged. Whatever is left over on the left was removed; whatever is left over on the right was added. There is no third category — a “modified” line is a removal and an addition that happen to sit next to each other, which is why a patch file contains both.
This tool uses Myers’ algorithm, published in 1986 and the default in git. Its useful property is that its cost scales with the number of differences rather than with the size of the input, so two large files that differ by three lines compare almost instantly. Two files with nothing in common are the expensive case, and there the tool stops trying to align them and says so.
One consequence worth knowing: a diff is not unique. Several different edit scripts can turn one file into another, and the algorithm picks a shortest one. When a change is genuinely ambiguous — a repeated line, a moved block — different tools can legitimately show it differently.
Side-by-side vs unified diff
The same comparison, presented two ways. Neither is more accurate; they suit different questions.
Side by side
Two columns, original on the left and modified on the right, aligned so corresponding lines sit opposite each other. Best when lines were rewritten, because you can read both versions of the same line at once. It needs width, which is why the tool above switches to tabs on a phone rather than squeezing two columns into a screen neither fits.
Unified
One column, with removals and additions interleaved and marked - and +. It is the format git diff, diff -u and patch files use, so it is what to copy when the diff is going somewhere else.
A unified diff, with the parts named
1--- original ← the two files2+++ modified3@@ -1,4 +1,4 @@ ← where this hunk sits in each4 const name = "John"; ← context: unchanged, one space5-const age = 30; ← removed from the original6+const age = 31; ← added in the modified7 console.log(name);
The @@ header is what makes a unified diff applicable rather than merely readable: it tells patch which lines of which file the hunk belongs to. The unified view here emits real headers, so what you copy can be fed to git apply.
One caveat: if you have turned on an ignore option, the diff describes a normalised comparison, and the hunks may not apply cleanly to the literal file.
Text diff vs code diff
Underneath they are the same operation. A line comparison does not know or care whether a line is a sentence or a function signature, which is why one tool can handle prose, source code, CSV, YAML and log files without a mode switch.
What differs is which settings suit which material.
Code wants line granularity and strict whitespace. A line is a meaningful unit, and indentation is significant in Python, YAML and Makefiles. Leave the ignore options off unless you have a specific reason.
Prose often wants word granularity. Paragraphs are long lines, so a reworded sentence turns the whole line red and green at line granularity. Word granularity highlights the words that actually moved.
Generated output often wants ignore options. Comparing a build artefact against a committed one, trailing whitespace and blank-line differences are usually noise from the generator rather than real changes. When the two sides came out of different tools, the JavaScript formatter or the CSS formatter will put both into one shape first, so the diff shows changes rather than style.
Syntax highlighting affects the editors only. It never changes what counts as a difference — a diff that depended on which language you had selected would be a diff you could not trust.
For JSON specifically there is a distinction worth making. A text diff reports a reordered key as a change, because as text it is one. If the question is whether two documents mean the same thing regardless of key order and formatting, that is a structural comparison — the JSON Diff and JSON Compare tools do it properly.
What is a merge?
Comparing tells you what differs. Merging is deciding what the combined result should be — going through the differences and choosing, for each one, what the final version says.
The merge helper above lists every changed block and offers three choices per block: keep the original, keep the modified, or keep both. The result is assembled from those choices and stays editable, so anything the three options do not cover can be typed by hand.
Every block starts unresolved, and that is deliberate rather than cautious — see the next section for why nothing can safely be chosen for you. Anything still unresolved appears in the result between conflict markers:
These are the markers git uses, and they are deliberately not valid in any language — the result cannot be pasted anywhere until a person has dealt with them. Nothing is ever silently discarded.
Two-way vs three-way merge
This distinction is the reason the merge here asks you about everything, and it is worth understanding before trusting any merge tool.
Two-way
Two inputs: an original and a modified version. You can see every difference — and that is all you can see. When a line differs, nothing in the input says whether the left side changed it, the right side changed it, or both did. Those are three completely different situations and they look identical.
Two inputs — every difference looks the same
1Original ──┐2 ├──▶ differences ──▶ you decide, every time3Modified ──┘
Three-way
Three inputs: the common ancestor both versions started from, plus the two versions. This is what git has, because it knows the commit both branches diverged from.
Three inputs — most differences answer themselves
1Base ──┐2Ours ──┼──▶ compare each side to the base3Theirs ──┘45 matches base on one side, differs on the other6 → only one side changed it: take that side78 both sides differ from base, and from each other9 → a real conflict: ask
The ancestor turns most differences into arithmetic. If a line matches the base on one side and differs on the other, exactly one side changed it, and that side wins — no question needed. Only when both sides changed the same line differently is there a genuine conflict, which is far rarer than the number of differences suggests.
That is why git merges most branches without asking anything, and why a two-way tool cannot. With two inputs every difference is potentially a conflict, so presenting some of them as automatically resolved would be a guess dressed as an answer.
The practical reading: use this to combine two files you have in front of you — a config against a backup, a draft against an edit, generated output against a committed copy. When the two versions have a shared history, let git do it.
When should you use a diff checker?
Mostly when you have two versions of something and no version control between them.
Reviewing changes before committing. Reading a change as a diff catches the debug line you left in far more reliably than rereading the file.
Comparing configuration files.A working config against a broken one, or a server’s against the version in your repository.
Comparing JSON or API responses. What changed between two calls, or between a fixture and what the service now returns.
Checking generated output. Whether a build, a migration or a formatter changed anything it should not have.
Reviewing text revisions. What an editor changed in a draft, where word granularity earns its place.
Investigating an unexpected change. Something works on one machine and not another, and the two copies of the file are the first place to look.
Verifying a copy or a migration. Confirming that text survived an export, an encoding change or a move between systems intact.
When two versions do share a history, version control is the better tool: it knows the ancestor, merges automatically where it safely can, and records who changed what. This is for the cases where that history does not exist.
Frequently asked questions
What is a diff checker?
A diff checker compares two versions of text or code and shows what changed between them — which lines were added, which were removed, and which are the same. It is the same idea as `git diff` or the review view in a pull request, applied to two blocks of text you paste in yourself.
How does a diff tool work?
It treats each version as a sequence of lines and finds the longest sequence of lines common to both. Everything in that common sequence is unchanged; everything left over on the left was removed, and everything left over on the right was added. This tool uses Myers' algorithm, the same one git uses by default.
Can I compare two text files?
Yes — open both, copy their contents into the two panels, and the comparison appears as you type. There is no upload step, so there is no file size negotiation either; the practical limit is 50,000 lines a side, and the tool says so plainly if you exceed it.
Can I compare source code?
Yes, and it is the commonest use. The comparison is language-agnostic — it compares lines, so JavaScript, Python, Go, Rust, Terraform and anything else all work the same way. The syntax highlighting dropdown affects the editors only and never changes what counts as a difference.
Can I compare JSON?
You can, as text, which is what you want when checking a generated file against a committed one. If you want to know whether two documents are semantically the same regardless of key order and formatting, the JSON Diff and JSON Compare tools do that structurally — a text diff will report a reordered key as a change, because as text it is one.
Can I compare Markdown?
Yes. Markdown is plain text, so the line comparison works exactly as it does for code. Word granularity is often the better view for prose: a reworded sentence shows as a few highlighted words rather than as one whole line replaced by another.
What is a unified diff?
The compact single-column format used by `diff -u`, `git diff` and patch files. Removed lines are prefixed with `-`, added lines with `+`, and unchanged context lines with a space, grouped into hunks with a `@@ -1,4 +1,4 @@` header saying where each hunk belongs. The unified view here produces the real format, headers and all, so what you copy can be fed to `patch` or `git apply`.
What is a side-by-side diff?
Two columns, the original on the left and the modified on the right, aligned so that corresponding lines sit opposite each other. It is easier to read when lines were rewritten rather than added or deleted, because you can see both versions of the same line at once.
What is a line diff?
A comparison where the unit is a whole line: a line either matches or it does not. It is the default here and the right choice for code, where a line is a meaningful unit and indentation matters.
What is a word diff?
A comparison that looks inside a changed line to show which words actually differ. Rename one variable and a line diff paints the whole line as changed; a word diff highlights the four characters that moved. It is most useful for prose and for long lines. Here it refines the line diff rather than replacing it, so the line numbers stay meaningful.
Can I ignore whitespace?
Yes, along with blank lines, letter case and trailing whitespace, each independently. All four are off by default, because whitespace genuinely matters in Python, YAML, Makefiles and anything indentation-sensitive. Turning one on changes only what is compared — the text on screen is always exactly what you pasted.
Can I ignore case?
Yes. It is useful when comparing content that has been through a system that normalised capitalisation, or when checking whether two lists contain the same items. Like the other ignore options it never rewrites your input.
Why does whitespace show up as a difference?
Because by default it is one. A trailing space, a tab where spaces were expected, or an indentation change are all real differences to a compiler, a YAML parser and to git. If they are noise for your comparison, turn on “ignore whitespace” or “trim trailing whitespace” and the tool will show a banner confirming the comparison is normalised.
Why are line endings showing as differences?
They should not be here — CRLF, LF and CR are normalised before the comparison, so the same file saved on Windows and on macOS compares as identical. That normalisation is only for the comparison: your text is never rewritten. If you specifically need to detect a line-ending change, this tool will not show it, and `file` or `git diff` will.
Does the tool support Unicode?
Yes. Accented characters, emoji, Devanagari, Arabic, Chinese and Unicode punctuation all compare and merge without corruption. Word granularity understands them too — `दुनिया` is one word, not six characters, and `naïve` is one word rather than three.
Can I merge two versions?
Yes, with the merge helper. It lists every changed block and lets you choose, per block, whether to keep the original, keep the modified, or keep both. The merged result is assembled from your choices and stays editable, so you can adjust anything by hand before copying it out.
What is a two-way merge?
A merge with only two inputs — an original and a modified version — and no record of what came before either. It can show you every difference and let you choose between them, but it cannot tell you which side did the changing, because nothing in the input says.
What is a three-way merge?
A merge with three inputs: the common ancestor both versions started from, plus the two versions. The ancestor is what makes automatic merging possible — if a line matches the ancestor on one side and differs on the other, only one side changed it and that side wins, with no question asked. A real conflict is when both sides changed the same line differently, which is rarer than it sounds.
Why can this tool not do a three-way merge?
Because it has two inputs, not three. Without the common ancestor there is no way to distinguish “you changed this line” from “they changed this line” from “you both did” — every difference looks identical. Rather than guess, every block starts unresolved and waits for you.
Is this a replacement for Git?
No, and it is not trying to be. Git tracks history, knows the ancestor of every change, merges automatically when it safely can, and records who did what. This compares two blocks of text you have in front of you. It is useful precisely when you do not have version control — comparing a config file against a backup, a generated file against a committed one, or two drafts nobody committed.
What happens to unresolved changes when I merge?
They are written into the result between conflict markers — `<<<<<<< Original`, `=======` and `>>>>>>> Modified` — the same markers git uses. Nothing is discarded and nothing is chosen for you. The markers are deliberately not valid in any language, so the result cannot be pasted anywhere until a person has dealt with them.
Can I copy or download the diff?
Both. “Copy diff” puts the unified diff on your clipboard, and the download button saves it as `changes.diff`. The merged result has its own copy and download buttons, saving as `merged.txt`. Each input panel also has its own copy button.
Can I compare large files?
Up to 50,000 lines a side. Two large files that differ slightly compare almost instantly, because the algorithm's cost scales with the number of differences rather than the size of the input. Two large files with nothing in common are the expensive case, and there the tool stops trying to align them line by line and says so rather than freezing.
Does this tool upload my content, and is my code stored?
Neither. The comparison, the merge, the copy and the download all run in your browser as JavaScript on this page. There is no request carrying your text anywhere, nothing is written to a server, and no analytics event contains what you pasted. You can confirm it by disconnecting from the internet — the page carries on working.
Is the diff checker free?
Yes, with no account and no limit on how many comparisons you run. It is a static page with the comparison built into it.
Keep going
Tools that pair with this one
Same privacy model — everything below runs in your browser too.