Start with something real.
Paste a natural-language prompt, or try the sample. Code and detected quoted literals are kept unchanged.
Compressing...
A little less prompt. A little more room.
Turn wordy instructions into a smaller prompt.
Compare the result. Keep what works.
No account needed · Free, open-source SDK
A little less, right here.
Your complete result will appear here.Your text is processed by the hosted service. Prompt contents are not saved to our database. Privacy details
The short version.
TokenShrink is open-source prompt compression for developers and AI users who send long natural-language prompts to AI models. It turns wordy instructions into a smaller prompt, keeps code and detected quoted literals unchanged, and shows the complete output, including any decoder, so you can compare before you use it. Try the free web compressor with no account, add the free open-source JavaScript SDK (npm install tokenshrink), or call the hosted API with a key; paid hosted plans start at $5/month. It works with any LLM that accepts text prompts. Token counts are estimates, not a promise of lower bills or identical answers, so check the answer with your own model.
Small steps. Clear results.
Paste a natural-language prompt, or try the sample. Code and detected quoted literals are kept unchanged.
Compare the complete output, including any decoder. Short inputs may already be as compact as they need to be.
Try both versions with your model. Adopt compression when the answer stays useful and the complete cost improves.
Fits into your code.
Use the JavaScript SDK locally, or the hosted API with a key. You decide which prompts to compress and how to evaluate them.
Read the quick startnpm install tokenshrinkimport { compress } from 'tokenshrink';
const result = compress(yourPrompt);
// Complete output, including any decoder.
const prompt = result.compressed;
// Estimates. Check with your model tokenizer.
console.log(result.stats.tokensSaved);Designed to earn your trust.
Token counts are estimates, not a promise of lower bills or identical answers. Caching, output and retries matter too. Our experimental engine stays separate from the product you use today.