System Prompt Compressor
Trim safe filler and normalize prompts locally in your browser
About
Remove common filler, normalize whitespace and bullets, deduplicate repeated sentences, apply safe abbreviations, and compare approximate character-based token counts. No LLM or network request is used.
Examples
Filler plus abbreviation
compressSystemPrompt("Please answer. For example, use JSON."){ compressed: "answer. e.g., use JSON." }The polite filler is stripped and for example becomes e.g. with one count logged per rule.
Duplicate sentence removal
compressSystemPrompt("Repeat this. Repeat this. Keep this."){ compressed: "Repeat this. Keep this.", changes: [{ rule: "Removed repeated sentences", count: 1 }] }The second identical sentence is dropped case-insensitively while distinct content is preserved.
About this tool
System Prompt Compressor shrinks long system prompts with compressSystemPrompt(input): it strips polite filler (please/kindly, as-an-AI self-references), substitutes for example → e.g., that is → i.e., versus → vs., normalizes bullet markers to dashes, removes repeated sentences case-insensitively, and collapses whitespace. The result carries original/compressed characters and chars/4 token estimates plus savingsRatio.
Every transformation is counted: the changes array holds CompressionRuleLog entries ({ rule, count }) with exact per-rule occurrence counts, so you can audit how many fillers, abbreviations, bullets, duplicates, and whitespace normalizations fired. Identical inputs always return identical PromptCompressionResult objects — deterministic and fully client-side.
Behavior on edges is explicit: empty input returns zeros with no changes, whitespace-only input collapses to an empty string via one whitespace normalization, and distinct meaning-bearing sentences are never merged or reworded — only exact duplicate sentences are dropped.
How to use this tool
Paste the system prompt
Pass the full prompt string to compressSystemPrompt — empty or whitespace-only input is safe and returns zeros.
Read the compressed output
Use compressed for the model call and compare originalTokens against compressedTokens plus savingsRatio for the budget win.
Audit the rule log
Scan changes for per-rule counts (filler, abbreviations, bullets, duplicates, whitespace) to see exactly what was rewritten.
Keep distinct instructions
Confirm meaning-bearing sentences survived — only case-insensitive duplicate sentences are removed, never paraphrased.
Use cases
Fitting system prompts into context budgets
Squeeze filler and redundancy out of long instructions before counting tokens against the model limit.
Normalizing pasted prompt drafts
Unify bullet markers and whitespace across prompts assembled from docs, chats, and templates.
Auditing prompt rewrites
Use the per-rule change log to show reviewers exactly which compressions fired and how often.
Common mistakes
Mistake:Expecting paraphrasing or summarization.
Fix:Only conservative rewrites apply — filler removal, abbreviations, bullet/whitespace normalization, and exact duplicate drops.
Mistake:Assuming duplicate detection is case-sensitive.
Fix:Keys are lowercased, so REPEAT THIS counts as a repeat of Repeat this — vary the wording if both must stay.
Mistake:Treating token estimates as exact.
Fix:Tokens are chars/4 approximations; use a model tokenizer when you need exact billing-grade counts.
Frequently asked questions
What does this tool do?
It shrinks system prompts with compressSystemPrompt: filler stripping, e.g./i.e./vs. abbreviations, bullet and whitespace normalization, plus case-insensitive duplicate-sentence removal — with exact per-rule counts and chars/4 token estimates.
What happens with duplicates or whitespace-only input?
Exact duplicate sentences drop with a Removed repeated sentences count (REPEAT THIS equals Repeat this). Whitespace-only input collapses to an empty string via one whitespace normalization.
Is my prompt uploaded or stored?
No. Compression is deterministic and 100% client-side — your prompts never leave the browser.
Are token counts exact?
No, they are chars/4 approximations (originalTokens, compressedTokens, savedTokens). Use a model tokenizer when you need exact budgets.
Related guides
References & standards
Related tools
Agent Tool Flowchart Builder
Design agentic tool-call DAGs with decision branches and bounded loops. Validates reachability, cycle handling, and emits clean Mermaid flowcharts — fully in your browser.
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language