AI GLOSSARY · AI CONCEPTS
Tokenizer
Definition
A tokenizer divides text into units called tokens. In many language-model pipelines, it also maps those units to vocabulary IDs. Token boundaries and counts depend on the tokenizer and its configuration.
Also called: tokenizers, AI tokenizer.
In plain language
Before an AI model sees your message, a separate piece of software cuts the text into small chunks called tokens, and turns each chunk into a number. That software is the tokenizer. A common word may be one token, while a rare word, a name or a line of code may be cut into several. The reply is built from tokens too, and a second step turns them back into text. This matters for planning: limits and prices are counted in tokens, not words, and two models can count the same sentence differently because they can use different tokenizers or configurations. Tokenization transforms text into units and often IDs; that transformation is distinct from the model's subsequent prediction. For a count before sending a large prompt, use the provider's tool for the intended model and check whether it returns an estimate. Word-count rules of thumb can be inaccurate.
Technical definition
Language-model tokenization commonly combines normalization, pre-tokenization, a segmentation model and post-processing, with an associated vocabulary mapping tokens to IDs. A fixed deployed configuration may be deterministic, while methods such as BPE-Dropout can sample different segmentations. Sennrich, Haddow and Birch studied subword encoding for rare and unknown words in translation. A vocabulary alone does not specify the whole tokenization procedure, and decoding need not restore text removed or changed by normalization.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
context-window-packer 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A record of which files were kept, shrunk or dropped to fit one prompt's token budget, and why.
- Why it exercises the concept
- The packing skill uses token estimates to plan a budget. Check selected input with the intended model’s counting tool; the plan is not an exact provider count.
Skill by Skill Almanac · Illustrative, not executed
agent-session-cost-review 58/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A transcript-derived estimate of session token use, rather than an exact provider tokenizer count or billing record.
- Why it exercises the concept
- The report estimates usage from saved text. Model-specific counts, input/output rates, caching and configuration affect actual cost; compare estimates with provider usage records.
Coding tool · Illustrative, not executed
Claude Code
- What to try
/usage- What you see
- Claude Code's cost documentation says the Session block of this command shows the current session's token usage, with an estimated cost computed locally from token counts at list price unless an administrator has set a pricing table.
- Why it exercises the concept
- It is the place in a coding session where token counts, produced by the model's tokenizer, turn into a dollar figure you can act on.
How it shows up when you use agents
Text selected for a model request is tokenized under that model's configuration. An agent may select, summarize or omit files and tool results; not every available file or result is necessarily sent in full. Other modalities and protocol overhead can also affect usage.
Counts and prices are separate. Model choice, input/output rates, caching and configuration can change cost. Anthropic documents a model-specific counting endpoint and calls its result an estimate. Recount for the intended model rather than applying a percentage rule across model generations.
Worked example (illustrative)
Suppose one toy tokenizer represents a chosen string with two units and another uses three. These invented counts illustrate configuration dependence, not actual provider output. They do not determine a bill without the applicable pricing and usage rules.
Common confusions
- Tokenizer versus token. The token is the unit, such as a word, part of a word or a byte. The tokenizer is the tool that cuts text into those units and maps them to numbers. See Token.
- Tokenizer versus model. The tokenizer has no knowledge and is not trained to answer questions. A language-model tokenizer prepares inputs for a compatible model. Its configuration can include normalization and segmentation choices, and some training tokenizers use stochastic segmentation.
- Myth. "A token is a word." Words are often split, and punctuation, spaces and code symbols count too, so word counts only roughly track token counts.
- Myth. "Same text, same count everywhere." Counts can differ with tokenizer configuration; use the counting guidance for the intended model.
Related terms
Terms that mention Tokenizer
Guides that mention Tokenizer
More in AI concepts
Sources
- Neural Machine Translation of Rare Words with Subword Units, arXiv (Sennrich, Haddow and Birch) (accessed 2026-11-23)
- Token counting, Anthropic (Claude Docs) (accessed 2026-11-23)
- Manage costs effectively, Anthropic (Claude Code Docs) (accessed 2026-11-23)
- The tokenization pipeline, Hugging Face (accessed 2026-11-24)
- BPE-Dropout: Simple and Effective Subword Regularization, Provilkov et al. (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.
Review record
Last verified
Drafted by Claude (original draft) and Codex (automated revisions); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-24. Last verified .
Change log (6)
- : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
- : First version.
- : Verifier pass: Short reworded to model generation, dropped uncited subword claim, removed BPE aliases.
- : Targeted correction from source-supported early audit; complete exact-version review remains pending.
- : Removed fragile numerical model-scope claim and separated selected input, estimates and billing factors. Exact revision review pending.
- : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.