Tinker AI
Read reviews

Text Diff

Compare two blobs of text — for LLM patches, config diffs, and the things git can't help with.

Original
Modified
Diff output appears here.

When you actually need this

You asked an LLM to “refactor this function to use the new helper” and got back 200 lines. Most of it should be unchanged but you can’t tell at a glance. You’re comparing two YAML files where someone re-ordered the keys but swears they didn’t change values. You’re reviewing a copy-paste from a teammate’s chat into your config and you’re not sure what changed. You want to confirm a model’s gpt-4o → gpt-4o-mini migration patch only touched the model name and not the temperature setting.

Git diff handles the version-controlled case. This handles everything else: the unstaged paste, the LLM output, the two-API-response comparison, the “did this script just change the regex?” check.

Gotchas we keep hitting

Whitespace silently kills line diffs. Two files that differ only in trailing newlines or CRLF vs LF will appear completely red in line mode — every line marked changed. Toggle Ignore whitespace, or switch to word/char mode where whitespace differences are isolated.

Long lines wrap visually but diff per line. A 500-character minified JSON on one side and a formatted version on the other will both be a single “line” to a line-mode diff. They’ll mark as 100% different. Format both with our JSON Formatter first, then diff. Or use the JSON-aware mode if both parse — it computes the structural delta directly.

Word mode splits on whitespace, not punctuation. foo,bar vs foo,baz in word mode will mark foo,bar and foo,baz as different “words” — you don’t get the punctuation isolation you might expect. Char mode shows you the exact byte. Word mode is the right choice when comparing prose; char mode for short technical strings.

JSON-aware mode is structural, not textual. It ignores key order and uses array element identity (we hash by id field if present). If your arrays are positional (like a coordinate list), reordering is a meaningful change that this mode will hide. For positional arrays, stay in line mode.

Speed gets bad past ~100KB. jsdiff is O(nm) worst case. A 200KB-on-each-side diff in char mode can hang the tab for several seconds. Stay in line mode for big inputs, or split into smaller chunks first.

With AI in the loop

When asking an LLM to refactor code, ask for a unified diff rather than the full file. Two reasons. First, it’s a fraction of the output tokens — a 5-line change in a 500-line file is 10x cheaper as a diff than as a full rewrite. Second, you can paste the diff here and verify it matches your intent before applying. We’ve watched models slip in unrelated cleanups (renaming a variable, reformatting a comment) inside what should have been a one-line change. Diff review catches it.

For comparing two LLM responses to the same prompt — say you want to A/B-test a system prompt change — JSON-aware mode is the cleanest tool. The model output usually has the same structure with different content. You see the values that diverged, not noise from key ordering or whitespace.

When debugging “did the model add anything I didn’t ask for?”, char mode catches the smallest changes. We’ve found models adding stray semicolons, changing tabs to spaces, or swapping single for double quotes — all invisible in line mode, obvious in char mode.

FAQ

Why is my diff all-red?
Most likely a whitespace difference (trailing newline, line endings). Toggle "Ignore whitespace" to confirm. CRLF vs LF is the usual culprit when comparing files from Windows and Unix sources.
Does this support binary files?
No, text only. Inputs above ~1MB will slow the browser; for very large diffs, use git diff or diff(1) on the command line.
Can I get a real `diff --git` output?
The Copy button outputs unified-diff format that GitHub and most patch tools accept. It's not byte-perfect git format (no blob hashes) but it applies cleanly with `patch -p0`.
How does JSON-aware mode differ from text diff?
When both inputs parse as JSON, we compute a structural delta (jsondiffpatch). It ignores key reorder and detects array element moves, which a textual diff would mark as a complete rewrite.

Related tools in your toolbox