induwara.lk
induwara.lkAI · Tokenizers

AI Language Token Tax Calculator — Sinhala, Tamil & 20+ Languages

Paste any text to see its exact OpenAI token count, then how much more Sinhala, Tamil and other non-English scripts cost than the same content in English. Real tiktoken counts, in your browser, with per-request and monthly API cost. No signup, no upload.

By Induwara AshinsanaUpdated Jul 18, 2026
Measure your language token tax
tiktoken-exact · 100% in-browser

The newer ~200k-token vocabulary. Far more compact for Sinhala, Tamil and other non-Latin scripts.

Text never leaves your browser — no upload, no API call, no key.41 / 20,000 chars
Loading the o200k_base tokenizer…

API cost

Model preset
$

Editable — defaults to the selected model's documented rate.

Leave blank for per-request cost only.

Cost / request
English est. / request
Language surcharge / req
Set volume for /mo

Language token tax

Tokenizing the benchmark set…

Non-Latin code points absent from the vocabulary fall back to UTF-8 byte tokens, so scripts like Sinhala and Tamil fragment into many more tokens. The newer o200k_base vocabulary merges far more of those bytes than cl100k_base.

Token counts are exact for OpenAI models, produced by gpt-tokenizer (a browser port of OpenAI's tiktoken). Prices are a documented OpenAI snapshot and are editable. The cross-language framing follows Petrov et al. (2023).

How it works

Large language models bill per token, not per word or character. A token is a fragment of text a byte-pair-encoding (BPE) tokenizer produces from a fixed vocabulary. OpenAI publishes two vocabularies: cl100k_base (GPT-4, GPT-3.5) and o200k_base (GPT-4o and the o-series). This tool runs the real vocabularies locally through gpt-tokenizer, a JavaScript port of OpenAI's tiktoken, so the counts match what OpenAI charges you.

  1. Exact token count. Your text is encoded with the selected vocabulary: tokens = encode(text).length. No API, no key, deterministic.
  2. Character basis. Characters are counted as Unicode code points, so a Sinhala grapheme counts as one. Chars-per-token and tokens-per-word show how densely the vocabulary packs your script.
  3. The language tax. The benchmark table tokenizes the same hand-translated sentence in each language and reports multiplier = tokens(lang) ÷ tokens(English), with English fixed at 1.00×. Petrov et al. (2023) show this ratio reaches ~15× across the world's languages, and non-Latin scripts pay the most.
  4. Byte-fallback ceiling.Code points missing from the vocabulary encode as their UTF-8 bytes, and a Sinhala or Tamil character is three bytes. So the theoretical maximum token count for any text is its UTF-8 byte length. The tool cross-checks every count against that ceiling and reports how much the vocabulary's merges saved — proof the count is sane and a direct measure of why o200k_base beats cl100k_base for these scripts.
  5. Cost. Per-request cost is tokens × price ÷ 1,000,000. The English estimate uses OpenAI's documented ≈4-characters-per-token rule, so the “surcharge” is the extra you pay purely for the script. Enter a monthly request volume to project the monthly language tax.

Prices default to a documented snapshot of OpenAI's published rates (verified 2026-07-18) and are editable, because published prices move more often than tokenizer vocabularies do.

Worked examples

Greeting — “Good morning. How are you today?”

  1. English: 32 chars → 8 tokens on both o200k_base and cl100k_base (baseline 1.00×).
  2. Sinhala (සුභ උදෑසනක්. ඔබට අද කෙසේද?): 26 chars → 17 tokens on o200k_base (2.13×), 45 on cl100k_base (5.63×).
  3. Tamil (காலை வணக்கம். இன்று எப்படி இருக்கிறீர்கள்?): 42 chars → 13 tokens on o200k_base (1.63×), 57 on cl100k_base (7.13×).
  4. Takeaway: on the older GPT-4/3.5 tokenizer the Sinhala greeting costs 5.6× and Tamil 7.1× the English tokens; GPT-4o's o200k_base cuts that to ~2.1× / 1.6×.

News sentence — “The government announced new tax rates for the next financial year.”

  1. English: 67 chars → 12 tokens (baseline 1.00×).
  2. Sinhala: 58 chars → 34 tokens on o200k_base (2.83×), 104 on cl100k_base (8.67×).
  3. Tamil: 65 chars → 24 tokens on o200k_base (2.00×), 85 on cl100k_base (7.08×).
  4. Byte cross-check (Sinhala, cl100k_base): 104 tokens sit under the 152-byte UTF-8 ceiling — merges saved (152−104)/152 = 32%.

Cost reconciliation — Sinhala news sentence, cl100k_base, at $2.50 / 1M tokens

  1. Per request: 104 × 2.50 ÷ 1,000,000 = $0.00026.
  2. English estimate: ceil(58 ÷ 4) = 15 tokens → 15 × 2.50 ÷ 1,000,000 = $0.0000375.
  3. Surcharge per request: $0.00026 − $0.0000375 ≈ $0.00022.
  4. At 100,000 requests/month: $26.00 total vs an English-equivalent $3.75 — about $22/month of pure language tax on one message shape.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.