Skip to main content
When you send text to a model it doesn’t read words the same way people do — it processes tokens. This lesson makes that concrete by using a tokenizer and observing how different inputs map to tokens. Seeing how text becomes tokens helps you reason about two crucial things: how much an interaction costs and how much information a model can process at once.
Tokens are the atomic units models process. Tokenization can split words into subword pieces, include punctuation and whitespace, and vary by model family. Use a tokenizer when you need precise token counts for budgeting or capacity planning.
The tokenizer used in these examples is tiktokenizer.com. It’s straightforward: paste or type text into the prompt area on the left, pick a tokenizer at the top, and the tool shows how the text is split into tokens and the numeric token IDs on the right. Everything updates live — no submission required. Try different tokenizers because the same text often tokenizes differently across model families. Let’s start with a short English sentence:
A human sees five words; the tokenizer shows six tokens — the extra one is the period. Each colored piece in the tokenizer view is a token and the number underneath is its token ID. Remember: the model processes token IDs, not the raw characters. A token is not the same as a word. Sometimes a whole word maps to a single token; sometimes a word is split into multiple subword tokens depending on the tokenizer vocabulary and rules. Formatting, punctuation, and whitespace matter. For short sentences that difference is small, but for long prompts, documents, or source code those differences add up because the model handles everything you send. Now let’s try a very long, uncommon word. I looked one up on Merriam‑Webster and pasted it into the tokenizer:
A screenshot of a Merriam‑Webster webpage titled "The Longest Long Words List," showing a photo of a very large reference book on a shelf and, below it, a figure wearing a hard hat and a respirator/gas mask.
Because uncommon words may not appear as single entries in a tokenizer’s vocabulary, the tokenizer often breaks them into multiple subword pieces. Example:
A small typo or spelling change can increase token count because the tokenizer may no longer find the same subword segments:
Numbers and non‑Latin scripts often split into multiple tokens depending on the tokenizer’s vocabulary and segmentation rules. For example, the digit string “1234567890” can be broken into several tokens:
A browser screenshot of a web tool titled "Tiktokenizer for GPT-5.6 and LLM Prompts" showing a large prompt-builder area on the left and a token analysis panel on the right. The prompt contains "1234567890" and the token analysis shows a token count of 4 with tokenized IDs listed.
Emojis and other special characters may also expand into multiple tokens. For instance, three emojis mapped to six tokens with one tokenizer:
If you switch the tokenizer (for example, from a GPT-5.6-style tokenizer to a GPT-2-style tokenizer), the same emoji sequence can produce a different tokenization and token count:
Tools like tiktokenizer may indicate whether a tokenization is exact or estimated. Some models publish their encodings so tools can reproduce exact counts; others require estimation. Always check whether the tokenizer you used provides an exact or estimated count before relying on it for budgeting or capacity planning. Chat-style requests typically include extra structure beyond a user’s visible text — system instructions, assistant messages, conversation history, retrieved documents, and tool definitions. Those all contribute to the overall token count. Even a short chat exchange including system delimiters can add many tokens:
Because system prompts and chat-format delimiters consume tokens, consider the entire request payload (system messages, conversation context, retrieved data) when estimating usage — not just the user’s current message. Tokens also translate directly to cost: models are typically priced by the number of tokens processed (input + output). For example, a model’s pricing might list a “price per 1M tokens” for input and output — see OpenAI’s pricing for reference. A tiny 30-token prompt costs almost nothing, but as you add context, documents, or request longer outputs, costs increase rapidly.
A screenshot of the OpenAI Developers pricing page showing a "Flagship models" table with per‑1M token prices for gpt-5.6‑sol, gpt-5.6‑terra, and gpt-5.6‑luna. The site navigation and sidebar are also visible along with notes about regional processing and Fast mode.
When choosing a model, balance capability against cost. Frontier models deliver strong capabilities but are expensive per 1M tokens; smaller or specialized models are usually more cost‑effective for many tasks. Tokenization examples at a glance: Best practices and quick tips
  • Track the entire request: include system prompts, conversation history, retrieved docs, and tool definitions when estimating tokens.
  • Prefer token-aware tools or libraries (like official encodings when available) for exact counts.
  • Remove unneeded history, compress or summarize long retrieved documents, and use smaller models for tasks where high capability isn’t required to reduce cost.
  • Monitor token usage and cost regularly; token behavior can change across model versions and tokenizer updates.
Estimating tokens with the wrong tokenizer may mislead budgeting and capacity planning. Always confirm whether a tokenizer reports exact or estimated counts and use the encoder associated with the target model when accurate accounting matters.
Summary
  • Tokens are the unit models process; text is converted to token IDs before the model handles it.
  • Tokenization depends on the tokenizer and model family; the same text can yield different token counts across models.
  • Token count affects how much information a model can consider (the context window) and how much an interaction costs.
  • Always consider the full request payload — system messages, history, retrieved data — when estimating token usage, not just the visible user input.
For further reading:

Watch Video