Paste two texts to instantly see what changed. Line-by-line diff with color-coded additions and removals.
This tool uses the Longest Common Subsequence (LCS) algorithm to compute the minimum edit distance between two texts, then displays added lines in green and removed lines in red. Unchanged lines are shown in grey.
• Compare config files before and after changes.
• Review code changes without a git diff.
• Spot differences between two API responses.
• Check document edits and revisions.
## Diff two texts
curl -X POST https://apitoolkit.pro/api/v1/diff \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"a":"line one\nline two\nline three","b":"line one\nline TWO\nline three"}'
## JavaScript
const res = await fetch('https://apitoolkit.pro/api/v1/diff', {
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ a: originalText, b: modifiedText })
});
const { diff } = await res.json();
// diff: [{ type: 'same'|'add'|'remove', line: '...' }]