Compare two texts as a Git-style diff

Read a unified Git diff as files, hunks, additions, deletions, and context lines.

freeworks offlinenothing uploaded
ToolGit Diff Viewer
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Unified diff headers and hunk markers are parsed into file names and line groups. Hunk ranges provide line anchors while color remains presentation only.

  • Unified context makes changes reviewable without full files.
  • Rename and binary summaries are represented separately from text hunks.

Worked example

Compare config file changes
View a side-by-side diff showing port and debug flag changes in a config file
Input
											Input1: const port = 3000;
const host = 'localhost';
const debug = false;
Input2: const port = 8080;
const host = 'localhost';
const debug = true;
										
Output
												Original: const port = 3000;
const host = 'localhost';
const debug = false;
Modified: const port = 8080;
const host = 'localhost';
const debug = true;
											

When to use this

Pull requests, patch reviews, and CI artifacts render Git diffs.

Edge cases

  • Renames can have similarity scores without add/delete pairs.
  • Binary files have summaries instead of line hunks.
  • Spaces in file names are quoted or escaped in headers.

References