Free · No signup ES

The prompt compressor
that proves it didn't break your prompt.

Code, quoted strings, URLs and template variables are never touched — by construction, not by luck. Every compression comes with a checklist showing exactly which instructions survived. Works with ChatGPT, Claude, Gemini, and any LLM.

📊 See the real numbers 🌟 Support the project 💻 View source code
0 backend
Fast mode never leaves your browser
Verified
constraint checklist, not a promise

How PromptTrim Works

Three compression modes depending on your needs

Fast Mode (Free)

Rule-based compression. Removes filler words, redundant phrases, and verbose patterns instantly — no API key needed.

🤖

AI Mode (Anthropic · OpenAI · Gemini)

Your model rewrites the prompt, a second model audits the result against every constraint, and lost ones are repaired automatically. Bring your own key.

🧪

Local ML Mode (Experimental)

A small on-device model (TinyBERT, LLMLingua-2) compresses entirely in your browser — no API key, nothing leaves your machine. Its output always goes through the same protected regions and Constraint Ledger — see the real numbers on why that matters.

📊

Token Analytics

See exact token counts before and after, and what each API call costs — including the compression call itself, priced before you run it.

🔒

100% Private

Your prompts never touch our servers. API keys are used only in your current browser session and never sent to our servers.

The real numbers

No invented percentages. Generated by npm run bench against 40 real prompts in bench/corpus/, re-run before every release.

Generated by npm run bench on 2026-09-05. Tokens counted with the real o200k tokenizer (js-tiktoken) — never estimated. The ledger is enforced at every level here (the product default only enforces it at Aggressive) so blocked changes are visible at all three.

Production-style system prompts (40 prompts)

bench/corpus/phase0 + bench/corpus/phase2 — regression fixtures written to be already careful. A near-zero reduction here is the expected result: nothing gets invented to cut.

LevelAvg. token reductionAggregate token reductionCritical constraints preservedChanges blocked by the ledger
Light0.0%0.0% (4,523 → 4,523)100.0% (434/434)0
Balanced1.4%0.7% (4,523 → 4,491)100.0% (434/434)0
Aggressive1.6%0.9% (4,523 → 4,484)100.0% (434/434)0

Everyday chat-style prompts (10 prompts)

bench/corpus/phase6 — unengineered requests padded with the framing and hedges people type without thinking about it.

LevelAvg. token reductionAggregate token reductionCritical constraints preservedChanges blocked by the ledger
Light0.0%0.0% (2,426 → 2,426)100.0% (60/60)0
Balanced9.0%8.9% (2,426 → 2,209)100.0% (60/60)0
Aggressive12.3%12.2% (2,426 → 2,129)100.0% (60/60)0

AI mode not measured for: Anthropic, OpenAI, Google Gemini. No percentage is published for a provider that was not actually called.

Local ML mode (TinyBERT via LLMLingua-2, real on-device inference), Balanced level, 3-prompt sample from the everyday corpus:

Critical constraints preservedProtected-region violations
25.0% (5/20)0/8

What PromptTrim does NOT do

Honesty as a feature, not a disclaimer. Every point below is a real, current limit of this exact codebase.

🚫

Does not touch protected regions

Code fences, inline code, quoted strings, URLs, template variables and few-shot examples are structurally excluded from every rule — not "usually skipped," never even offered to a rule as a candidate.

🚫

Does not delete instruction words

"never", "always", "must", "only", "step by step" and anything like them are never removed, at any level. packages/core/src/rules/discarded.ts lists every rule from the old app that did this, and why it was cut.

🚫

Does not prove full meaning is preserved

The ledger verifies that specific constraints (prohibitions, formats, numbers, quoted literals, variables) survive — not that the compressed prompt reads identically to a human. Review Aggressive output before shipping it.

🚫

Does not send Fast mode prompts anywhere

There is no backend. Fast mode compresses in your browser tab and nothing leaves it. AI mode goes straight from your browser to the provider you pick, with your own key — never through a PromptTrim server, because none exists.

🚫

Does not check requirements in every language yet

The constraint ledger's prohibition/requirement/format detection is English-only today. A prompt in Spanish or another language still gets the protected-region safety net, but not that checklist — this is tracked, not hidden.

🚫

Does not run batch prompts through AI mode

Batch mode (several prompts separated by ---) is Fast mode only. Firing an unbounded number of paid API calls from one click is not a default anyone should get by accident.

🚫

Does not trust Local ML mode's output on its own

LLMLingua-2 drops tokens by statistical importance, not meaning — our own benchmark above measured it keeping only 25% of critical constraints unaided. It's marked experimental for exactly that reason: the protected regions and Constraint Ledger it always runs through are what make it usable, not a claim that the model itself is reliable.

Compress or cache?

Compressing a prompt saves 15–30% once. Caching its static prefix saves about 90% on every repeated call. PromptTrim tells you which one is worth doing.

✂️

Compression is a one-off

Rewriting removes the filler and stops. A shorter prompt is cheaper on every call, but the ceiling is whatever filler your prompt had — typically 15–30%, and none of it on the code, JSON or examples PromptTrim refuses to touch.

Caching repeats

A cache hit costs 10% of the input price on Anthropic, OpenAI and Gemini alike. Writing the cache costs 1.25× the input price for a 5-minute lifetime, or 2× for an hour — so it pays for itself on the 2nd call, or the 3rd for the 1-hour cache.

⚠️

One date can silently kill it

A cache only matches an identical prefix. Today’s date, a request id or a template variable at the top of a system prompt changes those bytes on every call: no cache hit, no error, full price. PromptTrim finds them and offers to move them below the breakpoint.

📏

And minimums are real

Nothing shorter than 512 tokens caches on Claude Opus 5, 1,024 on Sonnet 5, 4,096 on Haiku 4.5, 1,024 on GPT-5.6 and later (2,048 before it) and 2,048 on Gemini 2.5. Under those, caching does nothing at all — quietly.

Prices and caching rules verified on 2026-09-03 against the official documentation of Anthropic, OpenAI and Google.

Frequently Asked Questions

Does this work for any AI model?
Yes. Compressed prompts work with ChatGPT (GPT-4o, GPT-4.1), Claude (Sonnet, Haiku, Opus), Gemini, Mistral, and any LLM. Tokens are counted similarly across all major providers.
Is my data private?
In Fast Mode and Local ML Mode, compression happens 100% in your browser — nothing leaves your device (Local ML Mode downloads a small model file once, then runs fully offline). In AI Mode, your prompt is sent directly from your browser to the provider you pick (Anthropic, OpenAI or Google) using your own API key. The key stays in memory unless you tick “Remember in this browser”, which stores it in sessionStorage until you close the tab. We never see your prompts or keys.
How much can I save?
It depends entirely on how much filler the prompt already has — see the real numbers above, generated by npm run bench. An already-careful system prompt barely shrinks in Fast Mode, and that's correct: there's nothing safe left to cut. A verbose, unedited prompt full of "please", "in order to" and framing typically compresses noticeably more. AI Mode isn't benchmarked with real providers yet (see the note above the tables); no percentage is published for it until it is.
Is compressing always the right move?
No, and PromptTrim will say so. If the same static prefix goes out thousands of times a day, prompt caching cuts about 90% off it on every call after the first, while compression cuts 15-30% once. The Cost Advisor prices both against your own call volume and recommends the cheaper one - including "don't compress, reorder these sections and cache".
Can I trust Local ML mode?
Not on its own — that's why it's labeled experimental. It runs a small model (TinyBERT, LLMLingua-2) entirely in your browser, with no idea what it's cutting; our own benchmark measured it preserving only 25% of critical constraints unaided. What makes it usable at all is that its output always goes through the exact same protected regions and Constraint Ledger as Fast and AI mode, so every loss shows up as a ✗ you can restore with one click, rather than a silently corrupted prompt.
Will compression change what the AI does?
Slight differences are possible, especially in Aggressive mode. Balanced mode is designed to preserve the full intent and context of your original prompt. Always review the output before using in production.
How is the token count calculated?
It depends on the target model you pick. For OpenAI models we run the real o200k tokenizer in your browser, so the count is exact. For Gemini, entering your API key gets you an exact count from Google's own countTokens endpoint; without a key it falls back to an estimate, same as Claude, which has no public browser-side tokenizer.
How do I know it didn't lose anything?
You don't have to take the app's word for it — check the checklist. Before compressing, PromptTrim extracts every prohibition, requirement, output format, number and quoted literal from your prompt. After compressing, it verifies each one against the result and shows a ✓ or ✗ per item, with a Restore button next to anything lost. That verification always runs locally in your browser, in Fast, AI and Local ML mode alike, and in AI mode it has the final say over what the model itself reports.