Skip to content
YAS.SH
Developer🔒 Browser (client-side)API available📴 Works offlineintermediate

Text Comparison

Compares two texts and highlights what changed.

Data stays in your browser
Ready to runInstant execution
All tools →
Original
Changed

What does this tool do?

Compares two texts and highlights what changed.

Why would I use it?

  • You want to see what changed between two config or document versions.
  • You are reviewing a colleague's edit.
  • You are validating that only expected lines changed.

Real-life example

Input
Left: "version: 1"
Right: "version: 2"
Output
- version: 1
+ version: 2

Removed lines and added lines are shown side-by-side.

Input → Process → Output → Next

Input
Paste both versions.
Process
The browser computes a line/character diff.
Output
Highlighted additions and removals.
Next action
Review the diff before merging or applying changes.

Common mistakes

  • Comparing different line endings (CRLF vs LF) causing noise.
  • Expecting semantic diffing — it is textual.
  • Ignoring whitespace differences that the tool highlights.

What the result means

Additions/removals are highlighted; unchanged lines are context.

Privacy & security

Your input is processed entirely in your browser and never sent to a YAS server.

API

Endpoint
POST https://yas.sh/api/v1/tools/text-diff
Request Header
Content-Type: application/json
cURL
curl -X POST "https://yas.sh/api/v1/tools/text-diff" \
  -H "Content-Type: application/json" \
  -d '{"a":"one\ntwo","b":"one\nthree"}'
JavaScript
const res = await fetch("https://yas.sh/api/v1/tools/text-diff", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "a": "one\ntwo",
  "b": "one\nthree"
}),
});
const data = await res.json();
Python
import requests

r = requests.post("https://yas.sh/api/v1/tools/text-diff", json={"a":"one\ntwo","b":"one\nthree"})
data = r.json()
FieldTypeRequiredDescription
astringYesLeft text (≤ 50 KB)
bstringYesRight text (≤ 50 KB)
Success response
{ "slug": "text-diff", "added": 1, "removed": 1, "unchanged": 1, "result": [{ "op": " ", "line": "one" }, ...] }

Line-based diff (LCS) between two texts (≤ 2,000 lines each).

Error responses
  • 400 VALIDATION_ERROR — invalid input or unsupported option.
  • 413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.
  • 429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).
Limits
  • Maximum input: 64 KB per request.
  • Rate limit: 60 requests/min per IP address.
  • Authenticated accounts benefit from higher tier quotas.

Text Comparison: technical reference, use cases and FAQ

How Text Comparison works

The two inputs are split into comparable units — usually lines — and aligned by computing a longest common subsequence. The LCS is the longest ordered sequence of units present in both texts; everything outside it is classified as an insertion in the second text or a deletion from the first. This is the same algorithmic family behind diff(1) and git diff, which is why the output shape is familiar.

Alignment quality depends entirely on the unit you compare. Line-level diffing on a file where one long paragraph changed marks the whole paragraph as replaced; word- or character-level diffing on the same input pinpoints the changed phrase but produces noisy output on code. There is no universally correct granularity, only the one that matches the change you are looking for.

When to use it: real-world scenarios

Finding what changed between two config versions

Comparing a working configuration against a broken one usually reduces an outage investigation to a single line. Normalise formatting first so the diff is not swamped by whitespace.

Reviewing an edited document without track changes

When someone returns a copy of a document rather than suggestions, a diff reconstructs the edit list they did not give you.

Comparing API responses across environments

Format both payloads with the JSON Formatter first — identical data serialized differently produces a diff full of false positives otherwise.

Verifying a copy or migration completed correctly

Diffing exported records against imported ones surfaces truncation, encoding damage and silently dropped rows.

Pro tips

  • Normalise line endings before diffing. A file converted between Windows and Unix shows every line as changed because CRLF differs from LF invisibly.
  • Sort both inputs first when order is not meaningful — for example lists of keys or dependencies — otherwise a reordering reads as a full rewrite.
  • Pretty-print structured data before comparing. A minified and an indented copy of identical JSON diff as completely different.
  • For large files, diff the section you care about. Whole-file comparison in a browser is slower and the output is harder to read than a targeted comparison.

Limitations and edge cases

What this tool deliberately does not do, and where it will disagree with other implementations.

  • Text only. Binary files, images and documents in compressed container formats (docx, xlsx) will not produce a meaningful comparison.
  • No semantic awareness: a renamed variable, a moved function or a reindented block reads as unrelated deletions and insertions.
  • Very large inputs are bounded by browser memory and main-thread time, since LCS computation is quadratic in the worst case.
  • No three-way merge or conflict resolution — this compares two texts, it does not combine them.

Frequently asked questions

Why does the diff show every line as changed?
Almost always mismatched line endings (CRLF versus LF) or a byte-order mark on one file. Both are invisible in most editors. Normalise line endings and compare again.
Is my text uploaded anywhere?
No. The comparison runs in your browser, so both documents stay in the tab. That also means the practical size limit is your available memory.
Can it show word-level changes inside a line?
The diff aligns by line first; a single-word change therefore marks the whole line. Split the text into shorter lines if you need finer granularity.
Does it handle moved blocks?
No. A block moved from one place to another appears as a deletion plus an insertion, because a plain LCS diff has no concept of a move.
Ask YAS AI
🍪 Cookies & privacy. Essential cookies keep you signed in and remember language and theme. Google AdSense and reCAPTCHA are Google technologies: AdSense runs only after Accept All; reCAPTCHA loads on sign-in and contact forms. See how Google uses data: https://policies.google.com/technologies/partner-sites cookie policy · privacy policy.
Settings