Text Compare (Diff Checker)

Compare two texts by lines, words, characters, sentences or JSON and get the changes, a similarity score and a unified diff patch.

Free tool: 20 requests per minute.

Result

Press “Run” to see the result.

Send the original text in a (or old) and the new text in b (or new). The API returns the list of changes (each one added, removed or unchanged with its value), stats with added, removed and unchanged counts, a similarity percentage and identical when nothing changed.

Choose the granularity with mode: lines (default, counts lines and also returns a unified diff like git diff), words, chars, sentences, or json which compares two JSON documents structurally after pretty printing. ignore_case and ignore_whitespace relax the comparison. For other modes, unified=true adds the patch; a_name, b_name and context (0-50 lines, default 3) control its header and context.

Both texts together may contain up to 2,000,000 characters (request body up to 4 MB).

Use this in your code

curl -X POST "https://apibox.io.vn/v1/text-diff" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":"one\ntwo\nthree","b":"one\n2\nthree\nfour"}'

API documentation → Get a free API key

FAQ

Can I get a git-style unified diff?

Yes. In the default lines mode the unified field always contains the patch; for other modes add unified=true.

How do I compare two JSON objects?

Use mode=json with both documents as JSON strings in a and b. They are pretty printed and compared line by line, so formatting differences are ignored.

How is similarity calculated?

Unchanged units divided by unchanged plus the larger of added or removed, as a percentage. Units are lines in lines/json mode and characters otherwise.