Back to Tools

TOON vs JSON Token Benchmark

TOON (Token-Oriented Object Notation) is commonly claimed to cut LLM token usage by 30-50%. Karvics ran that claim against real payloads using the same open-source tokenizer and TOON encoder this site ships in its own tools — including a case where TOON loses. Last run: 2026-07-22.

Results

Payloadcl100k_base (GPT-4)o200k_base (GPT-4o)Claude (approx.)
User records
Uniform array of 30 user objects — TOON's best case.
1176791 tokens (-32.7%)1170785 tokens (-32.9%)1176791 tokens (-32.7%)
API log entries
Uniform array of 40 log lines — a common tabular payload shape.
15121202 tokens (-20.5%)15521202 tokens (-22.6%)15121202 tokens (-20.5%)
Nested service config
Deeply nested, non-uniform object with no repeated array shape — a losing case for TOON.
173212 tokens (+22.5%)174211 tokens (+21.3%)173212 tokens (+22.5%)

Negative percentages (red) mean TOON used more tokens than JSON for that payload.

Methodology

Each input file is parsed as JSON, then encoded with @toon-format/toon's encode(). Both the compact JSON.stringify() output and the TOON output are tokenized with js-tiktoken's cl100k_base and o200k_base encoders. The "claude_approx_cl100k" column reuses the cl100k_base count as an approximation — there is no official offline Claude tokenizer in this toolchain, and Claude's real tokenizer is not publicly distributable, matching the same disclaimer already shown in the Token Count & Cost Estimator tool.

  • js-tiktoken version 1.0.21
  • @toon-format/toon version 2.3.1

Input Files

The exact JSON payloads used to generate the numbers above, so the results can be independently reproduced:

Honest Take

TOON's savings come specifically from uniform arrays of same-shaped objects — rows from a database or API list, where CSV-style formatting removes repeated key names. On deeply nested, non-uniform data with no repeated array shape, TOON adds structural overhead and can use more tokens than plain JSON, as the nested config payload above shows. Use the JSON to TOON converter to check your own payload shape before committing to it in a production prompt.