Topic 4 of 5 · 4 min read
Token costs across languages and formats
Goal: Compare token counts of the same content in two languages or formats and pick the cheaper representation for a task.
The same content can cost very different numbers of tokens depending on the language and the format, because tokenizers were built mostly from common English text. Words and layouts they know well are cheap. Unfamiliar ones are split into many small pieces.
Check yourself · 1 of 3
Why might the same message cost more tokens in some non-English languages?
Why it matters
If your users write in Arabic, Hindi or Thai, the same message may use noticeably more tokens than its English version. That means a higher bill, a smaller effective context window and slower replies for those users. The same applies to your data: a bulky format wastes tokens before the model has read a single idea.
Where the extra tokens come from
- Language. A tokenizer has a limited list. Text in languages that were less common in its training data is cut into smaller chunks, sometimes down to bytes. Tokenizers differ, and newer ones have improved on some languages, so measure rather than assume.
- Code. Indentation, brackets, long variable names and repeated keywords all add tokens. Minified code is not always cheaper, because it breaks into odd chunks.
- JSON and markup. Every quote, brace, comma and repeated field name is a token. A list of 100 records with the same ten field names pays for those names 100 times.
- Symbols and emoji. Rare symbols, emoji and some special characters can each take several tokens.
- Numbers and IDs. Long numbers, hashes and UUIDs are cut into many short pieces.
How to choose the cheaper form
- Measure, do not guess. Paste both versions into a tokenizer tool and compare.
- Send only the fields the task needs.
- For tables of records, a compact layout such as CSV or a plain list of rows often costs less than JSON, because field names appear once.
- Keep your instructions in a language the model handles well if quality and cost matter more than the user's language, and ask for the answer in the user's language.
Before and after
Before: Send 50 customer records as JSON with long field names such as "customer_full_name" and "customer_email_address" on every record.
After: Send a header row once, then one short line per record, and drop the fields the task does not use.
| Version | Layout | What you pay for |
|---|---|---|
| JSON | {"customer_full_name": "Ana Silva", "plan": "pro"} repeated per record |
Field names, quotes and braces on every record |
| CSV | name,plan once, then Ana Silva,pro per record |
Field names once, values per record |
What goes wrong
- People budget for English and are surprised when a different language costs more.
- People paste full API responses with dozens of unused fields.
- People shorten text by removing spaces or vowels, which often makes tokens worse, not better.
- People assume a smaller file always means fewer tokens. File size and token count are different things.
Examples
Same data, two layouts
A list of 100 orders in JSON repeats "order_id", "customer" and "total" 100 times each. The same list as a header line plus 100 short rows says those names once. Paste both into a tokenizer tool. The row layout usually gives a clearly smaller count, with the same information.
Budgeting for a second language
Your app summarises English support tickets and now launches in Arabic. Do not copy the English budget. Take ten real tickets, paste each language version into the tokenizer, and compare the counts. Set the new token budget and price estimate from what you measure.
Key points
- Token counts for the same content vary with language, format and tokenizer.
- Many non-English languages use more tokens than English for the same meaning, so cost and speed can differ by user.
- JSON repeats field names, quotes and braces; a compact table layout often uses fewer tokens.
- Trim fields the task does not need before you send data to a model.
- Always measure with a tokenizer tool; file size and word count are poor guides.
Common mistakes
- Using the English token count to budget for other languages.
- Sending whole API responses when the task needs three fields.
- Assuming smaller file size means fewer tokens.
- Removing spaces or vowels to save tokens and ending up with more.
Check yourself · 2 of 3
You must send 200 records with the same eight fields to a model. Which layout most likely uses the fewest tokens?
Check yourself · 3 of 3
A teammate shortens text by deleting vowels to save tokens. What is the likely result?
Practice items, not counted towards your mastery.
Start here
- Tokenizer (OpenAI) (opens in a new tab)ToolFree
Paste any text and see the token boundaries and count, coloured piece by piece.
- Tiktokenizer (compare tokenizers) (opens in a new tab)ToolFree
Switch between model tokenizers and see how the same text splits differently.
- Andrej Karpathy: minbpe and the GPT tokenizer lecture (opens in a new tab)ToolFree
A small tokenizer you can read, plus the lecture in text and video form on why spelling, arithmetic and non-English text go wrong.