Illustration of two text documents compared side by side, with lines highlighted in red for removed and green for added

Text Diff

Paste two versions of a text below and compare them line by line. Runs entirely in your browser — nothing is ever uploaded.


ℹ️ How this works
  • Compares line by line (not word-by-word or character-by-character) using the same longest-common-subsequence approach behind tools like diff or git diff.
  • Lines only in the Original are shown in red with a -; lines only in Changed are shown in green with a +; matching lines are shown plain.
  • "Ignore whitespace" trims each line before comparing (so re-indenting alone won't show as a change); "Ignore case" compares case-insensitively.
  • "Treat as JSON" parses each side and re-serializes it with sorted keys and 2-space indentation before diffing, so JSON that only differs in key order or formatting shows no diff at all — the actual line diff still runs on that normalized text.
  • Runs entirely client-side on this page — nothing you paste here is ever sent anywhere. The JSON API below is a separate, opt-in endpoint for scripts.
💻 Show API usage example (cURL)
curl -sS "https://devops.majbase.com/text-diff/api" \
    --data-urlencode 'original=line1
line2
line3' \
    --data-urlencode 'changed=line1
line2-modified
line3'

Returns JSON: {"diff": [{"type": "same"|"removed"|"added", "text": "..."}], "added": N, "removed": N, "same": N}. Add ignore_whitespace=true, ignore_case=true, and/or json_mode=true to match the page's checkboxes.