Text Compare (Diff)
Compare two texts side by side: different lines and characters, colour-coded changes, JSON with sorted keys and a .diff patch.
The link keeps what is on screen.
Both texts go into the share link (after the #, never sent to servers).
Original (A)
Changed (B)
Paste both texts to compare.
How is it calculated?
Uses the Myers algorithm (the same as git diff) to find the shortest sequence of inserted and removed lines. Removed and inserted lines side by side become “changed”, and within them Myers runs again by character or word to highlight only what changed. Options normalize the text before comparing (whitespace, case, CRLF, line order, formatted JSON or sorted keys). Similarity = equal characters × 2 ÷ total characters of both texts.
See the code ↗Processed in your browser; nothing is sent.
⌨️ Use from the terminal (JSON)
This tool also runs outside the site: the cli.js script uses the same logic as this page and returns the result as JSON. Parameters are the same as this page's URL — copy the command below with the values on screen.
Deno
deno run -q "https://thecodecodex.com/cli.js?tool=diff"
Node.js / Bun
curl -s https://thecodecodex.com/cli.js | node --input-type=module - diff a=…
| Parameter | Description | Default |
|---|---|---|
| a | texto original | — |
| b | texto alterado | — |
| gran | destaque dentro da linha: char | word | char |
| json | off | format | sortKeys | off |
| ws | 1 = ignora espaços extras | 0 |
| case | 1 = ignora maiúsculas | 0 |
| eol | 0 = diferencia CRLF de LF | 1 |
| sort | 1 = ordena as linhas antes | 0 |
Requires Deno, Node.js or Bun. With Deno the script runs with no permissions: it cannot read files or access the network. Central Bank indicators are from the day the site was published.