TokenSave logo TokenSave

TokenSave Data · Dataset

JSON vs YAML vs CSV vs TOON: how many tokens each format costs

The same 20-product table costs 1,336 GPT tokens as indented JSON and 429 as CSV (68% fewer). CSV was the cheapest format on every tokenizer we tested (Claude, Gemini, GPT), and the newer TOON format came close but did not beat it. XML was the most expensive.

Measured 2026-10-17 · 8 formats · 4 tokenizers · License CC BY 4.0 · Related: token cost by language

DOI 10.5281/zenodo.23435788 · Also on Hugging Face · Kaggle · GitHub

Tokens for the same 20-row table in 8 formats on Claude, Gemini and GPT

Key findings

All 8 formats

Tokens for the same table, with the difference versus indented JSON on the same tokenizer in brackets.

FormatClaude Opus/Sonnet 5.5Claude Haiku 4.5Gemini 3.xGPT o200k
TSV621 (-66%)477 (-71%)483 (-70%)427 (-68%)
CSV620 (-66%)476 (-71%)482 (-70%)429 (-68%)
TOON647 (-65%)502 (-69%)508 (-69%)474 (-65%)
Markdown table800 (-57%)649 (-60%)590 (-64%)539 (-60%)
JSON (minified)1,210 (-34%)847 (-48%)791 (-51%)763 (-43%)
YAML1,275 (-31%)1,074 (-34%)1,076 (-34%)997 (-25%)
JSON (indented)1,841 (±0%)1,618 (±0%)1,623 (±0%)1,336 (±0%)
XML2,200 (+20%)1,868 (+15%)1,873 (+15%)1,603 (+20%)

What the inputs look like

All eight files hold the same 20 products with 7 fields each (id, name, category, price, in stock, rating, tags). The full inputs are in the JSON download.

CSV

id,name,category,price,in_stock,rating,tags
1,Wireless Mouse,Electronics,24.99,true,4.5,office;wireless
2,Mechanical Keyboard,Electronics,89.0,true,4.7,office;gaming
…

TOON

products[20]{id,name,category,price,in_stock,rating,tags}:
  1,Wireless Mouse,Electronics,24.99,true,4.5,office|wireless
  2,Mechanical Keyboard,Electronics,89.0,true,4.7,office|gaming
…

JSON (indented)

{
  "products": [
    {
      "id": 1,
      "name": "Wireless Mouse",
      "category": "Electronics",
…

Method

Limitations

How to cite

Free to use, quote and republish with attribution under CC BY 4.0. Please link to this page.

TokenSave (2026). Token cost by data format: JSON vs YAML vs CSV vs TOON on Claude, Gemini and GPT [Data set]. Zenodo. https://doi.org/10.5281/zenodo.23435788

Embed the chart

Related

Questions or corrections: contact@jonhisking.com