AI GLOSSARY · AI CONCEPTS

Tokenization (NLP)

Markdown version · Wikidata Q2438971

Definition

Tokenization in natural language processing is the step that splits text into small units called tokens, such as words, parts of words or characters, which the model then processes.

Also called: tokenization in NLP, text tokenization, tokenization machine learning, tokenisation, tokenizing text.

In plain language

A language model cannot read letters the way you do. Before it sees your message, the text is cut into pieces called tokens. The cut can be at words, at single characters, or at parts of words. Many modern systems cut into parts of words, so a common word stays whole while a rare word or a name is split into several pieces. This matters in practice because limits and prices for AI tools are often counted in tokens; see Token. So the same text can cost different amounts under different models. The weak point is odd text, such as code, numbers or other languages, which may split into many pieces. Tokenization in data security is a different thing, with the same name.

Technical definition

Hugging Face's documentation describes three subword algorithms: byte pair encoding (BPE), Unigram and WordPiece. It describes word-level tokenization, where every distinct word needs its own entry so the vocabulary grows large and unknown words map to an unknown token, and character-level tokenization, where the vocabulary is small but sequences become much longer. BPE starts from characters and repeatedly merges the most frequent adjacent pair until a target vocabulary size is reached. Sennrich, Haddow and Birch (arXiv 1508.07909, first submitted 31 August 2015) proposed encoding rare and unknown words as sequences of subword units in neural machine translation. The documentation lists different models as using different algorithms, so token counts for the same text can differ between models.

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.

  1. 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
    Fitting text to a budget depends on measuring it in tokens, and tokenization is the step that decides how many tokens a file costs.
  2. 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 report on where a coding-agent session spent its tokens, found by parsing the saved session transcript.
    Why it exercises the concept
    Session usage is counted in tokens. The report shows how spend follows what was sent and generated, which tokenization turned into those counts.
  3. Guide · Illustrative, not executed

    What Is an LLM? The Facts Agent Users Need

    What you see
    A guide saying a large language model reads a sequence of tokens and predicts the next one, with notes on context windows, per-token pricing and errors.
    Why it exercises the concept
    It shows where token counts matter to a person using agents: window limits and price. Tokenization is the step that produces those counts.

How it shows up when you use agents

Messages and replies are split into tokens before the model processes them; see Token. That is why limits and bills are quoted in tokens. The context window is measured in them, and session cost follows how many were sent and generated. The component that does the splitting is the tokenizer; the pieces it produces are tokens.

What breaks when tokenization is misunderstood. People estimate cost or fit from word counts and are surprised. Code, long numbers, unusual names and some languages can split into many pieces, so they can use more of the window than their length suggests. Different models use different tokenizers, so a count from one model does not carry over to another. Counting characters and dividing by a fixed number gives only a rough guide.

Next action: measure instead of guessing. Use the model vendor's own token counting where it exists, and review a session's spend with agent-session-cost-review. When you must fit files into a prompt, context-window-packer records what was kept or dropped. For the wider field, see natural language processing.

Common confusions

  • Tokenization versus tokenizer. Tokenization is the process. The tokenizer is the component that performs it, with its own vocabulary.
  • A token versus a word. A token can be a whole word, a part of one or a single character. Hugging Face's documentation describes splitting rare words into subwords.
  • NLP tokenization versus data-security tokenization. IBM's page covers both senses, and its data-security token types (irreversible, reversible, format-preserving) are a different topic from splitting text for a language model.
  • Myth: the same text gives the same token count everywhere. The count depends on the tokenizer, so a different model can give a different number for the same text.

Terms that mention Tokenization (NLP)

6 terms mention this one

More in AI concepts

Next steps

  1. What Is an LLM? The Facts Agent Users Need The long-form guide.
  2. context-window-packer A skill that exercises it.
  3. Token Related term.
  4. Tokenizer Related term.
  5. All glossary terms A to Z and by family.

Sources

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-sonnet-5-5; sources and example targets checked by claude-haiku-5-5 source check; claude-sonnet-5-5 editor pass on 2026-11-24. Last verified .

This entry is still in review, so it is not listed in search engines yet.

Change log (2)
  • : First version.
  • : Verifier pass: removed unsourced number-mapping claim, softened product and pricing claims, linked Token.