FIRST CH TOOLS / 15 DIFF CHECKER

Text & Code Diff Checker

Paste two texts or code snippets and every addition, deletion and change is highlighted line by line and word by word. For proofreading drafts, reviewing CSS/JS edits and comparing config files — and it exports a unified diff (.patch).

BEFORE / A
AFTER / B

Differences

0
Lines added
0
Lines removed
0
Lines changed
0
Lines unchanged

The export is a standard unified diff with three lines of context — git apply and patch read it as-is.

How to Use

  1. Drop in both versionsPaste the original on the left and the changed version on the right, or load text files with the File buttons. Comparison runs as you type.
  2. Choose how to read itSwitch between the inline view and the side-by-side view. For long documents, "Collapse unchanged" keeps only three lines of context around each change.
  3. Take the result with youCopy the diff as a unified diff (.patch) or download it. Everything runs in your browser and nothing is uploaded.

About This Tool

Lines are matched with patience diff: lines that occur exactly once in both texts become anchors that split the problem into small ranges, and only the ranges without anchors fall back to Myers’ shortest-edit-script algorithm. This is the same idea as Git’s --patience, and it avoids the failure mode where reordered blocks get matched to unrelated lines and the whole file turns red and green.

Paired changed lines are compared again at token level — runs of letters and digits are one token, CJK characters are one token each — and only the differing tokens are shaded. If a pair shares less than 30% of its characters it is treated as two unrelated lines and left unshaded. CRLF, CR and LF all count as the same line break, and trailing-whitespace-only differences are ignored by default (ignoring all whitespace is optional).

Each side is compared up to 50,000 lines. When two large, entirely unrelated texts are compared, the search stops at a bounded edit distance and falls back to "replace the whole block" so the browser never locks up.

From AI Agents

This diff logic is also published as the diff_check tool of the MCP (Model Context Protocol) server @first-ch/tools-mcp, so AI agents can call it directly without driving a browser. See Using these tools from AI agents for setup.

Setup

claude mcp add firstch-tools -- npx -y @first-ch/tools-mcp

Example calls

# unified diff plus the change counts
diff_check(a="original text", b="changed text")

# compare two files, including word-level changes
diff_check(
  pathA="/path/old.css", pathB="/path/new.css",
  format="both", ignoreWhitespace=true)

Other Tools