LLM Token Calculator

    See how many tokens your data costs as JSON, YAML or TOON — and what that adds up to.

    JSON payload
    TOON is 64% smaller than pretty JSON

    $22.25 saved per month at 100,000 calls.

    FormatCharsTokensCost / month
    JSON (pretty)561$35.00
    JSON (minified)343$21.50
    YAML369$23.00
    TOON204$12.75

    How to Cut Token Cost by Changing Format

    1. 1

      Paste the data you send to a model

      Any JSON payload you put into a prompt — records, search results, API responses, retrieved context.

    2. 2

      Compare the encodings

      The same data is re-encoded as minified JSON, YAML and TOON, and each is tokenised with the o200k_base tokenizer used by current GPT-4o and o-series models.

    3. 3

      Enter your price and volume

      Set your input price per million tokens and how many calls you make a month. The table converts token counts into real monthly spend.

    4. 4

      Adopt the cheapest format that fits

      For uniform arrays of records, TOON is usually the smallest by a wide margin because field names are written once as a header instead of repeating on every row.

    Frequently Asked Questions

    Models charge per token, and tokens are produced from characters. JSON repeats every field name on every record and spends tokens on braces, quotes and commas. TOON writes the field names once as a header row, so a 100-record array pays for the key names once rather than a hundred times.

    It depends entirely on shape. Uniform arrays of records — the common case for retrieved context and search results — see the largest reduction, because that is exactly the repetition TOON removes. Deeply nested or highly irregular objects save little or nothing. Paste your real payload above; the number it shows for your data is the only one that matters.

    o200k_base, the encoding used by GPT-4o and the o-series models. Other families tokenise differently — Claude and Gemini use their own vocabularies — so treat the counts as a close estimate for those rather than exact.

    Yes, though less than people expect. Removing indentation strips whitespace tokens, which typically saves a modest percentage. Changing the encoding itself saves far more than reformatting the same encoding, because it removes repeated structure rather than repeated spaces.

    TOON is plain text, so any model can read it, but no model has been specifically trained on it. Include a one-line description of the format in your system prompt, and validate the model's output. The saving has to be worth that overhead — for a handful of records it usually is not.

    No. The tokenizer runs in your browser, so prompts containing customer data or proprietary context are never transmitted.

    Related Tools