Text Diff API

Compare two texts, get line-by-line or word-by-word diff with additions, deletions, and unchanged segments.

2 Modes
Line & Word
<50ms
Response
LCS Algorithm
Accurate Diff

How It Works

Step 1
Send Two Texts
Pass original and modified text to compare
Step 2
We Compare
LCS algorithm finds additions, deletions, and unchanged parts
Step 3
Get Diff
Receive structured changes with stats summary

Playground

3 free requests/day without API key

Enter two texts and click Compare

API Documentation

Base URL
https://text-diff-tawny.vercel.app
Authentication
X-API-Key: your_key (header) or ?key=your_key (query)Get your free key below
POST/api/diff

Compare two texts and get a structured diff with additions, deletions, and unchanged segments.

Request Body (JSON)

ParameterTypeRequiredDescription
text1stringyesOriginal text to compare
text2stringyesModified text to compare against
modestringnoDiff mode: "line" or "word". Default: "line"

Response

{
  "changes": [
    { "type": "equal", "value": "Hello" },
    { "type": "delete", "value": "world" },
    { "type": "insert", "value": "Go" }
  ],
  "stats": {
    "additions": 1,
    "deletions": 1,
    "unchanged": 1,
    "identical": false
  }
}

Error Responses

// 400 — Bad Request
{ "error": "Missing 'text1' and 'text2' fields" }

// 401 — Unauthorized
{ "error": "Invalid API key" }

// 429 — Rate Limited
{ "error": "Daily limit reached. Upgrade your plan." }

Get API Key

Get a free API key for 6 requests/day. No credit card required.

Usage

  • Add header: X-API-Key: your_key
  • Or query param: ?key=your_key

Limits

  • Playground (no key): 3 req/day
  • Free tier (with key): 6 req/day
  • Paid plans: see pricing below

Pricing

Start free. Pay only when you need more.

Free
$0
  • 6 requests/day
  • Line & word mode
  • Full diff output
Starter
🚀 Launch Price
$12$5/mo
  • 300 requests/day
  • Line & word mode
  • Full diff output
Business
🚀 Launch Price
$59$29/mo
  • 10,000 requests/day
  • Line & word mode
  • Priority support