Text Diff

Paste an original and a changed version to see exactly what moved, with line-level and inline character highlighting. Everything runs in your browser.

Options
Unified diff (patch)

Line diff, then character diff

The comparison happens in two passes. First alongest-common-subsequence pass over the lines finds the biggest run of lines that appear in both texts in the same order; every other line is tagged added or removed. Then, wherever a removed line is immediately followed by an added line, the tool runs a second LCS pass over the two lines' characters and highlights just the letters that differ. That is why a one-word edit shows as a mostly-grey line with a small red-and-green patch, not two entirely red-and-green lines.

Relaxing the match

Ignore whitespace trims each line before comparing, so re-indented code or reflowed prose stops showing as a change.Ignore case folds capitalisation. Both options only affect the comparison — the output still shows your text exactly as you pasted it, so you can see what the real (ignored) difference was.

The unified diff

"Copy unified diff" produces the same format git diff anddiff -u emit: a ---/+++ header, then @@ -oldStart,oldCount +newStart,newCount @@ hunks with three lines of context. A leading space marks an unchanged line,- a removal, + an addition. You can paste it into a code review, a bug report, or git apply.

Good pairings

Format both sides with the JSON formatterfirst for a clean structural diff; use theword counter to quantify how much changed; or the case converter to normalise before comparing.

Related tools

Frequently asked questions

How is the diff computed?
With a longest-common-subsequence (LCS) algorithm written for this tool — no external library. It finds the largest set of lines that appear in both texts in the same order, then marks everything else as added or removed.
What does the inline character diff show?
When a line is removed and the next line is added, they're treated as an edit of the same line. The tool then diffs them character by character so you can see the few characters that actually changed.
What do 'ignore whitespace' and 'ignore case' do?
Ignore whitespace trims leading and trailing spaces and tabs before comparing, so re-indented lines match. Ignore case compares letters without regard to capitalisation. Both keep your original text in the output — only the comparison is relaxed.
What is a unified diff?
The patch format used by git and diff -u: a --- / +++ header naming the two sides, then @@ hunks with three lines of context. A leading space is unchanged, - is removed, + is added. 'Copy unified diff' puts exactly that on your clipboard.
Is this a word diff or a line diff?
Primarily a line diff, with a character-level diff layered on for adjacent remove/add pairs. It is not a semantic or syntax-aware diff — it compares text, not meaning.
Is there a size limit?
There's no hard cap, but the algorithm is O(n×m) in the number of lines, so two very large files (tens of thousands of lines each) will be slow. For code review, diff a function or a file, not a whole repo.
Does my text leave the browser?
No. Both texts are compared locally in JavaScript. Nothing is uploaded, so it's safe for unreleased copy, contracts or code.
Can I diff JSON or CSV?
Yes, as text. For structural comparison, format both sides first — the JSON formatter gives stable key order, which makes a text diff far more readable.

Last reviewed: September 2026. Figures and formulas are checked against their published sources; see the site's data notes.