AIExplainer

What is a Token?

The basic unit of text that AI language models process, which may be a word, part of a word, or punctuation.

Pronunciation: /ˈtəʊkən/

A token is a piece of text that a language model reads and generates. Tokens are not always whole words — common words like "the" might be one token, while uncommon words might be split into multiple tokens. Punctuation and spaces can also be tokens.\n\nModels have limits on how many tokens they can process at once (the context window). Both your input and the model's output count toward this limit.

Think of speaking to a doctor. You say, "I don't feel well." Before the doctor responds, they may also review your medical history, recent test results, and current medications. The doctor's advice is based on all of that information, not just your first sentence. AI works similarly—it uses both your request and any additional context it's given, and all of that counts toward token usage.

Imagine you ask an AI, "Can you help me write a reply to this email?" Your question only uses a small number of tokens. But if the AI is also given the original email, previous messages, and some notes about the situation, all of that text is also counted as tokens. Token usage is based on everything the AI receives as context, not just what you type.

Developers monitor token usage because most AI APIs charge per token. Token counts determine how much text fits in a model's context window and affect response costs.

A token is not always a word. One token does not equal one word, and token counts vary between models and languages.

Tokenisation approaches evolved from word-level to subword methods like BPE (Byte Pair Encoding) and SentencePiece, enabling models to handle any language and vocabulary efficiently.

Tokenisation

Three products for different needs — explore what’s relevant to you.