Compress Code Before Sending to an LLM
Comments and blank lines add tokens without helping the model read your code. Put code in ``` fences and turn off “Preserve code blocks” to strip them.
AI DevRuns in your browser — nothing uploaded
How it works
- 1
Removes filler
Politeness and padding like “Could you please”, “It is important to note that” and “very” cost tokens and rarely change the answer.
- 2
Shortens wordy phrases
“In order to” becomes “to”, “due to the fact that” becomes “because”. Aggressive mode adds abbreviations like “e.g.” and “config”.
- 3
Drops repeated instructions
If the same sentence appears twice, only the first one is kept. Long system prompts often repeat themselves.
- 4
Handles code carefully
Fenced code blocks are left untouched by default. Turn off “Preserve code blocks” to strip comments and blank lines too.
Questions, answered
The default rules only remove words that carry no instruction, so answers are usually the same. Aggressive mode goes further — check the output before using it for anything important.
It is an estimate modelled on OpenAI’s tokenizer and is usually within about 10% for English text and code. Claude and Gemini tokenize slightly differently, but the percentage saved is similar.
No. The compressor runs in your browser. Your text never leaves your device.
Yes. Put code in ``` fenced blocks. By default they are kept exactly as written; with “Preserve code blocks” off, comments and blank lines are removed for Python, JavaScript, TypeScript, Go, Java, C-family, shell, YAML and HTML.
LLMLingua uses a small language model to decide which tokens to drop and needs a Python setup. This tool uses fixed rules, so it is instant, predictable and free to run in a browser — at the cost of lower compression on already-tight prompts.
Popular uses
Related tools
- Regex ExplainerPaste a regex, get plain English plus test cases.AI Dev
- AI SQL Query GeneratorEnglish to SQL for Postgres, MySQL and MSSQL.AI Dev
- JSON to Pydantic / TSInstant Pydantic models, TypeScript types or dataclasses.AI Dev
- JSON to TOON ConverterShrink JSON for LLM prompts with TOON — and convert back.AI Dev