Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

Text Diff Checker API

Compare two texts line by line (Myers diff) and return added, removed and unchanged lines, plus a unified-style text diff.

POST /api/v1/tools/text-diffMCP text_diffDeveloper Tools

Compare two versions of text or code and see exactly which lines were added, removed or unchanged, with counts. Can ignore case and whitespace. Runs in your browser.

Input

Send these as a JSON object. Unknown fields are rejected.

original
The original (old) text. (string, up to 500000 characters, required)
changed
The changed (new) text. (string, up to 500000 characters, required)
ignoreCase
Treat upper and lower case as the same. (boolean, default false)
ignoreWhitespace
Ignore leading/trailing whitespace and treat runs of whitespace as one space. (boolean, default false)
ops
Also return the list of operations ({ type: equal|add|remove, text, oldLine, newLine }). (boolean, default false)
curl https://pithlab.com/api/v1/tools/text-diff \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"original":"apples\nbananas\ncherries","changed":"apples\nblueberries\ncherries\ndates"}'
Example response
{
  "ok": true,
  "result": {
    "identical": false,
    "added": 2,
    "removed": 1,
    "unchanged": 2,
    "diff": "  apples\n- bananas\n+ blueberries\n  cherries\n+ dates"
  }
}