b2KIT

Git Diff Visualizer

Paste unified diff output and see a color-coded side-by-side or inline diff with line-level statistics.

Tested tool guide Tested browser tools Checked August 16, 2026

What Git Diff Visualizer does, with a checked example

Git Diff Visualizer turns pasted unified diff text into a color-coded review of files and hunks, available as adjacent old/new columns or as one inline stream. It also summarizes added and deleted lines, so a replacement contributes to both totals. The input must already be a unified diff, such as output from `git diff`; two unmarked source files are not compared. Because patches may contain unpublished code, the pasted text is processed in the browser and is not uploaded.

Worked example

A concrete input and expected output from the current implementation.

Input

--- a/greeting.txt
+++ b/greeting.txt
@@ -1,2 +1,2 @@
 Hello
-Colour
+Color

Expected output

Statistics: 1 addition and 1 deletion. The unchanged context is `Hello` at old line 1 and new line 1. `Colour` is removed from old line 2, and `Color` is added at new line 2. In side-by-side mode, those line-2 entries appear on the old and new sides.

The hunk header says both versions span two lines starting at line 1. The space-prefixed line is context, while the `-` and `+` lines each contribute one counted change; the path headers are not content changes.

How the result is produced

1

Reading unified diff structure

The visualizer reads the `---` and `+++` file markers, then uses each `@@` hunk header to identify old and new line ranges. Within a hunk, a leading space marks unchanged context, `-` identifies an old-side removal, and `+` identifies a new-side addition. The file-marker lines themselves describe paths rather than content changes.

2

Views and line statistics

Side-by-side mode separates the old and new line sequences into neighboring columns; inline mode preserves the patch's single vertical sequence. In either presentation, color distinguishes context, removals, and additions. The statistics are line based. Replacing one complete line with another is represented by one deletion plus one addition, even when only one character changed.

Good uses

  • Reviewing a patch copied from `git diff` before committing, especially when several hunks touch the same file.
  • Turning a diff pasted into an issue, chat, or build log into a readable old-versus-new view without checking out the repository.
  • Checking whether a generated patch contains unexpected whole-line additions or deletions by inspecting its coloring and totals.

Limits and checks

  • Only unified diff syntax carries the file paths, hunk ranges, and line prefixes the visualizer needs; two plain code blocks are not an equivalent input.
  • The totals describe patch lines, not characters or semantic changes. A one-character replacement can appear as one added line and one deleted line.
  • The display does not establish that the patch applies cleanly to a current checkout; stale context, conflicts, and repository state remain outside the visualization.

Common questions

Can I paste two complete files instead of a diff?

No. This viewer expects unified diff text with file and hunk markers; it does not derive a comparison from two independent file bodies. Produce a patch first, for example with `git diff` in a repository or `git diff --no-index old.txt new.txt`, then paste that command's output.

Why does a one-line edit show both an addition and a deletion?

Unified diff records the original line with a `-` prefix and its replacement with a `+` prefix. Git Diff Visualizer reports those records separately, so changing `Colour` to `Color` yields one deletion and one addition. The side-by-side view can place them opposite each other, but the statistics do not collapse them into one modification.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools