TokenPad
Prompts

Prompt Whitespace Cleaner

Remove the invisible characters you are paying for on every request.

Your input

53 characters5 lines0 tokensor drop a file

Whitespace CleanerExact
0Token change
Token change0no change
Input tokens0what you pasted
Output tokens0what you would send
Token cost of this result
Output tokens0
As input$0.00
× 100K requests$0.00

Everything on this page runs in your browser. Nothing you paste is transmitted, because there is no server here to transmit it to.

Result
 

Invisible does not mean free

Trailing whitespace is not visible in your editor and is billed exactly like any other character. Prompts assembled from template literals, indented inside source code, or concatenated across several files accumulate it steadily.

On its own the saving is small. On a system prompt sent on every request by every user, small recurring costs are the ones worth removing, because they compound in a way one-off costs do not.

The line this tool will not cross

It never touches single spaces between words. This is the mistake that turns a whitespace cleanup into a cost increase.

In most byte-pair vocabularies the leading space is part of the word token — the encoder learned " the" as a unit, not "the". Removing spaces between words forces it off those common merges and onto fragments, so the token count goes up while the character count goes down.

Where the whitespace comes from

Template literals in indented code are the usual source: every line of the prompt inherits the indentation of the function it sits in. A prompt indented four levels carries eight spaces on every line, invisibly.

This is worth fixing at the source as well as here — either dedent at build time or keep long prompts in separate files.

Frequently asked questions

Why not just strip all whitespace?
Because it raises the token count. Leading spaces belong to word tokens in BPE vocabularies, so removing them fragments common words into uncommon pieces. Structural whitespace is waste; word spacing is not.
Do blank lines matter to the model?
Paragraph separation helps readability and section boundaries. Three or more consecutive blank lines carry no additional meaning, which is why they collapse to two rather than to none.

More prompts tools