PlayTools

Diff Checker

Compare two blocks of text and see a line-by-line diff with added and removed lines highlighted, plus options to ignore whitespace and case.

Runs in your browser — nothing you enter is uploaded

Added

+0

Removed

−0

Unchanged

1

Paste text into both boxes to compare.

This is a line-level diff computed with a longest-common-subsequence algorithm: lines present in both texts are the anchor, and everything else is marked added (in the changed text) or removed (from the original). It does not highlight within-line character changes. The comparison runs entirely in your browser — paste code, config or prose freely.

Advertisement

How a text diff is computed

A diff answers a precise question: what is the smallest set of line additions and deletions that turns the first text into the second? This tool answers it with the classic approach — split both texts into lines, find their longest common subsequence (the longest run of lines that appears in both, in the same order), and treat every line not on that path as added or removed.

The longest-common-subsequence choice matters. It means moved blocks, inserted paragraphs and deleted sections are all reported as local changes rather than making everything after them look different. Lines that appear in both texts act as anchors that keep the two sides aligned. Each row shows the line number in the original text, the line number in the changed text, a +/− marker, and the line itself.

This is a line-level diff, not a character-level one. If a single word in a line changes, the whole old line is marked removed and the whole new line added — there is no inline word highlighting. That keeps the output simple and predictable, and it is what most code review and "what changed" tasks actually need.

The two options change how lines are matched, not how they are shown. "Ignore whitespace" trims each line and collapses internal runs of spaces before comparing, so reindented code or reflowed prose still lines up. "Ignore case" makes lines that differ only in capitalisation count as unchanged. For diffing JSON or code, formatting both sides with consistent indentation first gives the cleanest result.

The comparison runs entirely in your browser, so you can paste private code or documents. Because the algorithm builds a table sized by the line counts of both sides, it is best suited to inputs up to a few hundred lines each.

Key formulas (reference)

lines A, lines B → LCS table  dp[i][j] = length of longest common subsequence of A[i:], B[j:]
walk from (0,0): equal line → keep (unchanged)
  else step toward the larger of dp[i+1][j] (delete A[i]) / dp[i][j+1] (add B[j])

These free tools pair well with this page — open them in a new tab to finish your workflow.

Advertisement

Frequently Asked Questions

What kind of diff is this?

A line-level diff. The two texts are split into lines and compared with a longest-common-subsequence algorithm: lines that appear in both, in order, are the unchanged anchor, and everything else is shown as added (present in the changed text) or removed (present only in the original).

Does it highlight changes within a line?

No. If a single word changes, the whole old line shows as removed and the whole new line as added. Character-level highlighting is a separate feature this tool does not do.

What do "ignore whitespace" and "ignore case" do?

They affect only how lines are matched, not how they are displayed. "Ignore whitespace" collapses runs of spaces and trims each line before comparing, so re-indented code lines up. "Ignore case" makes "Hello" and "hello" count as the same line.

What do the two number columns mean?

The first is the line number in the original text, the second is the line number in the changed text. Unchanged rows have both; a removed row has only the original number; an added row has only the changed number.

Can I diff code or JSON?

Yes — paste anything. For JSON specifically, formatting both sides with the JSON Formatter first (same indentation) makes the diff far more readable, since the algorithm compares lines as text.

Is there a size limit?

The LCS table is proportional to (lines in A) × (lines in B), so very large inputs — thousands of lines on each side — can get slow and memory-heavy. It is built for files up to a few hundred lines each, which covers most real reviews.

Is my text uploaded?

No. The comparison runs entirely in your browser. You can paste private code or documents; nothing is sent anywhere.