Prompts
Prompt diff: compare two prompt versions
Paste two versions of a prompt to see every word that changed, side by side or inline, plus the change in tokens and cost per call for your model and any template variables added or removed. Free, and it runs entirely in your browser.
Compared in your browser. Your prompts are never uploaded or put in the address bar.
Paste two versions of a prompt to see what changed.
Tokens and cost per call
$2 per 1M input tokens · prices updated 2026-10-12
| Version | Tokens | Per call | Per 1,000 calls |
|---|---|---|---|
| Original | – | – | – |
| New | – | – | – |
| Change | – | – | – |
Counted with o200k_base, OpenAI’s current tokenizer; OpenAI hasn’t published which one GPT-6.1 Sol uses. Cost is the prompt as input only, at the standard rate; caching, batch discounts and the reply aren’t included. Chat formatting adds a few tokens per message.
Template variables
Variables in either version appear here. Placeholders written as {{name}} or {name} are detected.
Steps
How to use the prompt diff
- Paste the current prompt into “Original prompt” and the edited one into “New prompt”.
- Pick side by side or inline, and compare by words or by lines. Tick “Ignore whitespace” or “Ignore case” to hide changes that don’t affect meaning.
- Choose the model you call to see the token count and input cost of each version, per call and per 1,000 calls.
- Check the template variables: any that were added or removed need a matching change in the code that fills in the prompt.
Method
How it works
Prompts change all the time: a rule is added after a bad answer, an example is swapped, a sentence is reworded. Small edits change how a model behaves, so it helps to see exactly what changed between the version that worked and the one you are about to ship. A general text diff shows the words. This tool also shows the two things a general diff misses: what the edit does to your token bill, and whether it broke the template your code fills in.
How the comparison works
The diff uses the Myers algorithm, the same approach behind git diff, through the open-source jsdiff library. In word mode each prompt is split into words (letters in any script, digits and underscores), punctuation marks and the spacing between them, so a changed number or a swapped comma shows up on its own. In line mode each line is one unit, which suits rule lists and few-shot examples. “Ignore whitespace” compares words without the spaces and line breaks around them (and lines with spacing collapsed), and “Ignore case” compares in lower case; either way, each side is still shown exactly as you wrote it. If two very long versions are too different to compare word by word quickly, the tool falls back to whole lines rather than freezing the page.
Tokens and cost
Both versions are counted with the tokenizer of the model you choose, in a background worker so typing stays smooth. Counts are exact for OpenAI models and for open-weight models whose tokenizer is public, such as DeepSeek, Qwen and Mistral. Anthropic and Google don’t publish their current tokenizers, so for Claude and Gemini the numbers are estimates made with OpenAI’s o200k_base and marked with ≈; the size of the change is still a fair guide. The cost is the prompt billed as input at the model’s standard price, refreshed daily from public price lists, including the higher long-context price when a prompt passes the model’s threshold. The reply, caching and batch discounts are left out because the wording of the prompt doesn’t decide them; the cost calculator covers the whole request.
A longer prompt costs more on every call, and an edit near the start of a prompt also resets prompt caching, because providers only reuse an identical prefix. Put stable instructions first and the parts you change often last.
Template variables
Most prompts in production are templates. The tool finds placeholders in two styles: double braces such as {{customer_name}} (Mustache, Handlebars, Jinja and most prompt tools, including filters such as {{ name | upper }}) and single braces such as {language} (Python’s str.format, f-strings and LangChain, including {user.name}, {items[0]} and format specs like {price:.2f}). It lists variables added, removed and kept, and those used a different number of times. A renamed variable shows up as one removed and one added, which is the case that breaks things: depending on the engine, a missing value raises an error (Python), renders as an empty string (Mustache, and Jinja by default) or reaches the model as the literal placeholder. JSON objects, code with spaces inside its braces, ${…} interpolation in JavaScript or shell, LaTeX commands and Handlebars helpers such as {{#each}} aren’t counted, though a bare {x} in code looks the same as a Python placeholder and is listed. In Python templates, doubled braces are an escaped literal brace, not a variable; the tool can’t know which engine you use, so it lists both styles separately.
What it doesn’t do
It compares wording, not behaviour. Two prompts that differ by one word can produce very different answers, and a big rewrite can change nothing that matters. To know whether an edit helped, run both versions on the same set of test inputs and compare the outputs. Your prompts stay in your browser: they aren’t uploaded, stored or added to the page address, which is also why there is no share link.
Examples
Worked examples
What a 300-token addition to a system prompt costs (1,000 → 1,300 tokens)
| Model | Extra per call | Per 1,000 calls | Per 1,000,000 calls |
|---|---|---|---|
| GPT-6.1 Sol | $0.0006 | $0.60 | $600.00 |
| GPT-6 Luna | $0.00003 | $0.03 | $30.00 |
| Claude Opus 5.5 | $0.0012 | $1.20 | $1,200 |
| Claude Sonnet 5.5 | $0.0006 | $0.60 | $600.00 |
| Claude Haiku 5.5 | $0.00003 | $0.03 | $30.00 |
| Gemini 3.8 Flash | $0.000225 | $0.22 | $225.00 |
Standard input prices on 2026-10-12, before any caching or batch discount. 300 extra tokens is roughly 225 English words, two or three short paragraphs.
Which placeholders count as variables
| Style | Prompt text | Variables found |
|---|---|---|
| Mustache, Handlebars | Hello {{name}}, your order {{ order_id }} has shipped. | {{name}}, {{order_id}} |
| Jinja with a filter | Summarise this for {{ audience | lower }}: {{document}} | {{audience}}, {{document}} |
| Python format, f-string, LangChain | Translate {text} into {language}. Price: {price:.2f} | {language}, {price}, {text} |
| Attribute and index | Write to {user.first_name} about {items[0]}. | {items[0]}, {user.first_name} |
| JSON and code (ignored) | Reply as {"answer": "yes"}. if (x) { return y } `Hi ${user}` | none |
| Handlebars helpers (ignored) | {{#each steps}}{{/each}} {{! comment}} | none |
FAQ
Frequently asked questions
How do I compare two versions of a prompt?
Paste the current prompt on the left and the edited one on the right. Changed words are highlighted: removed text struck through, added text marked. Switch between side by side and inline, compare by words or whole lines, and ignore whitespace or case if you only care about real wording changes. Below the diff you see the token and cost change for your model and any template variables that were added or removed. To judge which version works better, run both on the same test inputs.
Why does a small prompt edit change my API bill?
A system prompt or template is sent as input on every call, so its tokens are paid for every time. Adding 300 tokens costs little once but adds up over thousands of calls a day. The tool prices the change per call and per 1,000 calls with the model’s current input price, so you can see what an edit costs before you ship it.
Does editing a prompt break prompt caching?
It can. Prompt caching only reuses an identical prefix, the exact tokens at the start of a request. An edit near the top of a long system prompt changes everything after it, so the next calls pay full price and write a new cache entry. Keep fixed instructions first and put the parts you change often near the end.
Are the token counts exact for Claude and Gemini?
No. Anthropic and Google don’t publish their current tokenizers, so for their models the tool counts with OpenAI’s o200k_base and labels the numbers as estimates. Counts are exact for OpenAI models and for open-weight models whose tokenizer we host, such as DeepSeek, Qwen and Mistral. For an official Claude or Gemini count, use the token counter with your own API key.
Which template variable styles does it detect?
Double braces, as in {{name}}, used by Mustache, Handlebars, Jinja and most prompt tools, including Jinja filters such as {{ name | upper }}. Single braces, as in {name}, used by Python’s str.format, f-strings and LangChain, including {user.name}, {items[0]} and format specs such as {price:.2f}. JSON, code such as { return x }, ${…} interpolation in JavaScript or shell, and Handlebars helpers like {{#each}} are not counted as variables.
Can I share a prompt diff with a link?
No, on purpose. A shareable link would have to carry both prompts in the address, and addresses end up in browser history, server logs and chat previews. Prompts often contain internal instructions or customer data, so nothing you paste leaves your browser. To share a result, copy the text or take a screenshot.
When should I compare by words and when by lines?
Words suit prose instructions, where one changed adjective or number matters and lines are long paragraphs. Lines suit structured prompts such as lists of rules, few-shot examples or XML sections, where you want to see which rules were added, removed or rewritten. In side by side view with words selected, changed lines also show exactly which words changed.
Related
Related tools
- Prompt BuilderBuild prompts with variables and a live token count.
- AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.
- Prompt Caching CalculatorEstimate savings from prompt caching.
- LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.
- Context Window CheckerSee whether your text fits each model’s context window.