Text Diff Viewer

Paste two texts to instantly see what changed. Line-by-line diff with color-coded additions and removals.

About the Diff Viewer

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.

Use Cases

• 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.

API Example

## 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: '...' }]

Get API Key — $5/mo →

Other Free Developer Tools