T1 · Beginner · 7 minStable · Last reviewed: 2026-08-19Early draft

Tokens — the Currency of Everything

In one line · A token is a small chunk of text (a word or part of one) — the unit that measures length and cost.

Glossary:Context WindowToken
Best to read first:What Is an LLM?
Why it matters

Both your bill and the context window are counted in tokens, not words. Miss this and cost and limits will surprise you.

Picture text broken into small Lego pieces. Each piece is a token. The model reads and writes in these, and you pay per piece.

'hello' is often one token, but a long Arabic word may split into several — so the same meaning can cost more tokens in Arabic.

How it works

Before text reaches the model, it passes through a tokenizer: a program that splits it into pieces from a fixed vocabulary built at training time. Common English words get one token; rare words and other languages split into smaller pieces. The model then operates on token IDs, not letters — which is why it sometimes fumbles counting characters or reversing text. Your bill is input tokens plus output tokens combined.

Practice

🧪 Try it: take an English sentence and its Arabic translation, and count each one's tokens with any tokenizer (like your model provider's tokenizer tool). Compare the counts, then try a long word and a URL and see how they split.

Common mistakes

Common mistakes: (1) measuring length in words or characters and getting surprised when you blow past the context window; (2) thinking only input is billed — output is usually pricier per token; (3) assuming Arabic and English cost the same — the same meaning in Arabic can take double the tokens or more.

When to use it

Think in tokens for any decision about cost or length: pricing a feature, chunking documents for RAG, capping user message size, or comparing models.

When NOT to use it

Don't turn everything into token obsession: for prototypes or low volume, the difference is pennies. Optimize cost when real usage justifies it.

LET'S BUILD ITDone reading — now build it yourself.Count the tokens in a string