Text diff

Compare two texts line by line and get a unified diff with counts of added and removed lines.

Input

The original text.
The changed text.
Unchanged lines to show around each change.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/diff \
  -H 'Content-Type: application/json' \
  -d '{"input":{"before":"apple\nbanana\ncherry\n","after":"apple\nblueberry\ncherry\ndate\n"}}'
import json, urllib.request

body = {'input': {'before': 'apple\nbanana\ncherry\n', 'after': 'apple\nblueberry\ncherry\ndate\n'}}
request = urllib.request.Request("https://setget.net/v1/tools/diff", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/diff", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"before":"apple\nbanana\ncherry\n","after":"apple\nblueberry\ncherry\ndate\n"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "diff",
  "input": {
    "before": "apple\nbanana\ncherry\n",
    "after": "apple\nblueberry\ncherry\ndate\n"
  }
}
{
  "input": {
    "before": "apple\nbanana\ncherry\n",
    "after": "apple\nblueberry\ncherry\ndate\n"
  }
}

Endpoint: POST /v1/tools/diff. Over MCP: run_tool with slug: "diff". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
before string yes The original text.
after string yes The changed text.
context integer no Unchanged lines to show around each change. Default: 3. From 0 to 1000.

Examples

Input
{
  "before": "apple\nbanana\ncherry\n",
  "after": "apple\nblueberry\ncherry\ndate\n"
}
Result
{
  "text": "--- before\n+++ after\n@@ -1,3 +1,4 @@\n apple\n-banana\n+blueberry\n cherry\n+date\n",
  "added": 2,
  "removed": 1,
  "hunks": 1,
  "equal": false
}

Identical texts

Input
{
  "before": "same\n",
  "after": "same\n"
}
Result
{
  "text": "",
  "added": 0,
  "removed": 0,
  "hunks": 0,
  "equal": true
}

Questions

What does "\ No newline at end of file" mean?
The line above it is the last line of a text that does not end with a line break. The marker lets a patch tool rebuild the text exactly.
Can I apply the result with patch or git apply?
Yes. The output is a standard unified diff. The file names are "before" and "after".
Are Windows line endings a difference?
No. Windows (CRLF) line endings are treated as plain line breaks in both texts.