View & Query · Runs in your browser

JSON Token Counter

Count how many tokens your JSON or prompt uses before sending it to an LLM, and see how much minifying saves.

JSON or text
Drop a file to load it
Token counts
Waiting for input

How to use it

  1. Paste the JSON or prompt you plan to send.
  2. Read the token counts for each tokenizer.
  3. Turn on “Minify JSON first” to see how many tokens whitespace is costing you.

Exact for OpenAI

Counts for GPT-4o (o200k_base) and GPT-4 / GPT-3.5 (cl100k_base) use the real tokenizers and are exact.

Estimates for others

Claude, Gemini and Llama use their own tokenizers, which aren’t public in the same form. Their figure is an estimate and is labelled as one.

Save tokens

Indentation and line breaks are tokens too. Minified JSON is often 20–40% smaller, and shorter key names help in large arrays.