Diff Viewer
Paste a git diff, unified diff, or .patch file and turn it into a clean inline view, side-by-side columns, a git-style stat summary, or structured JSON. Runs locally in your browser.
About this tool
The diff viewer turns a pasted unified diff into a readable review artifact. It accepts output from git diff, diff -u, or a .patch file and parses the patch into files, hunks, line numbers, additions, deletions, renames, binary-file markers, and file-level stats.
Choose the view that fits your workflow:
- Inline keeps the familiar unified diff shape, but adds a concise summary and per-file banners.
- Side-by-side aligns old and new lines in two text columns, so replacements are easy to scan.
- Stats produces a compact
git diff --statstyle table with plus/minus bars and totals. - JSON returns the parsed structure for scripts, review bots, dashboards, or downstream analysis.
Enable ignore whitespace-only changes when a patch is mostly indentation or formatting noise. Matching delete/add pairs that are identical after whitespace normalization become unchanged context and stop counting toward the totals. Everything runs locally in the browser; your patch is not uploaded.
FAQ
Does this compare two separate text files?
No. This tool views an already-computed unified diff — for example the output of git diff, diff -u old new, or a .patch file. Use a separate text-diff/comparison tool when you need to generate the diff from two inputs.
What diff formats are supported?
It supports common unified diff syntax: diff --git headers, ---/+++ file headers, @@ hunk headers, context/add/delete lines, new and deleted files, renames, binary-file markers, and hunk section headings. It is intentionally lenient about metadata lines such as index and file modes.
How does the side-by-side view align replacements?
Within each hunk, consecutive deleted and added lines are paired row by row. Changed pairs use a ~ marker on both sides, pure deletions use < on the old side, pure additions use > on the new side, and context lines show the same content on both sides.
What does ignore whitespace-only changes do?
When enabled, a deleted line followed by an added line with the same words after whitespace normalization is folded into a single context line. That hides indentation-only churn from the rendered output and removes it from the add/delete totals. Real content changes are still shown.
Is the patch uploaded or stored?
No. The parser is compiled to WebAssembly and runs in your browser tab. The pasted diff is processed locally and disappears when you close the page.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool diff-viewer 'diff --git a/src/main.rs b/src/main.rs
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,4 @@
fn main() {
- println!("hi");
+ println!("hello");
+ println!("world");
}'New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/diff-viewer/?diff=diff%20--git%20a%2Fsrc%2Fmain.rs%20b%2Fsrc%2Fmain.rs%0A---%20a%2Fsrc%2Fmain.rs%0A%2B%2B%2B%20b%2Fsrc%2Fmain.rs%0A%40%40%20-1%2C3%20%2B1%2C4%20%40%40%0A%20fn%20main%28%29%20%7B%0A-%20%20%20%20println%21%28%22hi%22%29%3B%0A%2B%20%20%20%20println%21%28%22hello%22%29%3B%0A%2B%20%20%20%20println%21%28%22world%22%29%3B%0A%20%7D&view=inline&ignore_whitespace=trueMachine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
