diff-merger
A diff merger shows two text versions side by side, highlights the differences, and lets you pick which side wins line by line β producing a single merged result. It's what git mergetool opens (vim-diff, kdiff3, Beyond Compare), but in a browser without installing anything. The ZTools Diff Merger tool handles plain text, JSON, YAML, code, and prose; supports three-way comparison (base + left + right) when given a common ancestor; and exports the merged output as a download or copy-paste.
Use casesβ
Resolve a Git merge conflictβ
Cloning a CLI mergetool is overkill for a one-off conflict. Paste both sides of the conflict, pick which lines to keep, copy the merged result back.
Merge two config filesβ
Two engineers edited the same .eslintrc independently. Combine their additions without losing either set.
Compare two API contractsβ
OpenAPI v1 and v2 β see what's changed, what's removed, what's renamed. Useful before publishing a deprecation note.
Edit prose collaborativelyβ
Two reviewers edited the same doc. A merger lets you accept one reviewer's rewrite of paragraph 3 and the other's of paragraph 5.
How it worksβ
- Paste left and right text β Two textareas, one per side. Optionally a third area for the common base (three-way merge).
- Diff renders β Line-by-line alignment using the Myers diff algorithm β same algorithm Git uses. Added / removed / changed lines colour-coded.
- Pick a side per chunk β For each diff chunk, click "use left", "use right", "use both", or "edit manually". The merged column updates live.
- Export merged result β Copy the final merged text or download as .txt. Original inputs are never modified.
Examplesβ
Input: Left: line A, line B, line C Right: line A, line B-edit, line C
Output: Diff: line B vs line B-edit. Click "use right" to take the edit; merged: line A, line B-edit, line C.
Input: Left adds a new line; right adds a different new line
Output: Two-way: pick one or both. Three-way (with base) detects this is "both added different things" and prompts for a manual merge.
Input: JSON merge: left adds key X, right adds key Y
Output: Both sides accepted produces an object with X and Y. Conflicts on the same key require manual choice.
Frequently asked questionsβ
Does it understand JSON / YAML semantically?
No β it diffs as text. For semantic JSON merge (key-aware, type-aware), use a dedicated JSON merge tool. Text diff catches most cases but can produce surprising results when whitespace differs.
How is this different from a diff viewer?
A diff viewer shows differences but produces no output. A merger lets you build a third version line by line. Same UI, more interaction.
Does it support patches (unified diff format)?
Read-only β paste a unified diff to visualise. To apply patches, use git apply or patch CLI.
What if the two inputs are completely different?
The diff has no aligned chunks; you'd be doing a copy job, not a merge. The tool will still show side-by-side text but with everything flagged as changed.
Can it ignore whitespace?
Yes β toggle "ignore whitespace" or "ignore case" before diffing. Useful for prose where line wrapping changed.
Privacy?
All comparison happens in your browser. No upload, no tracking of pasted content.
Tipsβ
- For Git conflicts, paste the part between <<<<<<< and >>>>>>> markers β the markers themselves go away after merge.
- Use three-way merge when you have a common ancestor β much cleaner conflict resolution.
- For very large files (10k+ lines), prefer a desktop tool (kdiff3, Beyond Compare) β browser memory and rendering get slow.
- When merging code, run formatter and tests after β a clean text merge can still introduce semantic errors.
Try it nowβ
The full diff-merger runs in your browser at https://ztools.zaions.com/diff-merger β no signup, no upload, no data leaves your device.
Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub