How a model slices text

A model does not read letters. First the text is cut into tokens, pieces from a fixed vocabulary. You pay for those pieces, and they fill the model’s memory.

Live tokenizer

OpenAI vocabularies are public, so they run right in your browser. Claude’s tokenizer is closed: only the API can count it.

What to try

  • Hindi, German, Japanese, Russian: the same question in English and in another language.
  • Strawberry: why models stumble over letters.
  • Typo: one swapped letter turns a token into two.

Switch vocabularies: GPT-3 (r50k), GPT-4 (cl100k) and GPT-4o (o200k). You can see the gap between languages shrink from one generation to the next.

Measurements across 20 languages, answers and typos are in the article “Is English really the cheapest language for prompts?”.