Back to Tools

Prompt Minifier

Extra spaces and pretty-printed JSON still become tokens. Minify a prompt locally and compare the token count before and after, including the savings across 100,000 calls.

Extra spaces and pretty-printed JSON still become tokens. Minify a prompt locally and compare the token count before and after, including the savings across 100,000 calls.

Sample rates are planning examples, not official prices. Confirm the current price on the provider’s pricing page. This page is not affiliated with OpenAI, Anthropic, Google, or DeepSeek, and it is not financial advice.

How to use the Prompt Minifier

  1. Paste the prompt, HTML, or JSON.
  2. Turn on the cleanups you want: extra spaces, blank lines, JSON indentation, and markdown filler.
  3. Compare tokens before and after. The percent saved is the drop divided by the original count.
  4. Dollar savings use the selected input rate times the tokens removed times 100,000 calls.

How token math works

Providers bill input tokens and output tokens separately, usually per 1 million tokens. This suite estimates English prose at 1 token per 4 characters (about 0.75 words per token), code and JSON at 1 token per 3 characters, and multilingual text at 1 token per 2 characters. Dollar figures use the rate you select. They update in the browser and are not a quote from a model provider.

Practical notes

  • Minify machine payloads, not prose you want the model to read as written. Removing spaces inside a sentence can change the instruction.
  • JSON is minified only when the text is valid JSON. Other text keeps its structure and only loses the spacing you selected.
  • Next: AI Token Cost Calculator.
  • Also compare with the Prompt Caching Savings Calculator.
  • Browse AI products in the AI tools directory when you want a tool listing rather than a token estimate.

FAQ

What does the minifier change?

Depending on the toggles, it collapses repeated spaces, removes blank lines, reprints valid JSON without indentation, and strips markdown markers such as heading hashes, asterisks, and fence lines.

Will a shorter prompt always cost less?

It costs less only when the provider bills the tokens you removed. A minified prompt can also be harder for the model to follow, so test the answer, not only the token count.

Are the savings for 100,000 calls exact?

They are the input-token savings times 100,000 at the rate you entered. Output tokens and failed calls are not included.