TokenPad
Format

JSON Formatter for Prompts

Format or minify a JSON payload, and see what the indentation costs.

Your input

103 characters1 lines0 tokensor drop a file

JSON FormatterExact
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
 

Why a JSON formatter needs a token counter

Every other JSON formatter on the web optimises for one reader: a human. That is the right default in an editor and the wrong one in a prompt, because the model does not benefit from indentation and you are billed for every space of it.

This one shows both sizes at once. Format it to read it, minify it to send it, and the counter tells you what the difference is worth. On a deeply nested payload the gap is routinely thirty to fifty percent of the tokens.

Why sorting keys matters for caching

Prompt caching matches on an exact prefix. If your serialiser emits keys in insertion order, two logically identical payloads can produce different bytes and miss the cache entirely.

Sorting keys alphabetically makes serialisation deterministic, which turns an unreliable cache hit into a reliable one. On a workload where the same reference document is sent repeatedly, that is worth considerably more than the formatting itself.

Where to go from here

If your data is tabular rather than nested, JSON is probably the wrong format altogether — the data format optimizer compares it against CSV and four other serialisations, and the cheapest is usually not JSON.

For a payload you have already minified, the prompt optimizer catches the whitespace that survives outside the JSON itself.

Frequently asked questions

Does minified JSON hurt the model’s comprehension?
No, for well-formed JSON. Structure is carried by the braces and commas, not the layout. What does hurt comprehension is ambiguity about where data ends and instructions begin, which is a delimiter problem — wrap the payload in a tag rather than relying on formatting.
Why does sorting keys change my token count slightly?
Because byte-pair encoding merges depend on adjacent characters. Reordering keys changes which characters sit next to each other, which changes the merges. The difference is usually under one percent, and the cache reliability is worth more.
Is my data sent anywhere?
No. Parsing, formatting and tokenizing all happen in your browser. There is no server on this site to receive it.

More format tools