Skip to content

Tokenisation Explained

How language models split text into tokens, why it affects cost, limits and quirks, and how to count tokens.

Editorial team 1 min read

Language models don't read characters or words directly. They read tokens — chunks of text from a fixed vocabulary.

How It Works

Tokenisers such as byte-pair encoding build a vocabulary of common character sequences. Frequent words become single tokens; rare words split into pieces. "Unbelievable" might become "un", "believ", "able".

Why It Matters

  • Cost: APIs charge per token.
  • Limits: context windows and output limits are measured in tokens.
  • Languages: many non-English languages need more tokens per word, raising cost.
  • Quirks: models can struggle with tasks that depend on characters within tokens — counting letters, reversing words, some arithmetic.

Rough Rules

For English, a token averages roughly three-quarters of a word, but this varies with the tokeniser and content. Code, numbers and unusual text use more tokens.

Counting Tokens

Providers offer tokeniser libraries or token-counting endpoints. Use them for accurate cost and limit calculations.

Different Models, Different Tokenisers

Token counts for the same text differ between model families, so compare costs using each model's own tokeniser.

More in Generative AI

All Generative AI guides →
Generative AI Guide · 2 min

Prompt Engineering Fundamentals

The building blocks of a good prompt — context, task, constraints and format — with before-and-after examples.

Generative AI 2 min read 24 Jul 2026

Generative AI Guide · 2 min

Few-Shot Prompting With Examples

Showing a model a few examples of the input and output you want is often clearer than describing it. How to choose good examples.

Generative AI 2 min read 23 Jul 2026

Generative AI Guide · 2 min

Getting Structured Output From LLMs

How to get JSON and other machine-readable output reliably from a language model, and how to validate it.

Generative AI 2 min read 22 Jul 2026

Generative AI Guide · 2 min

Why Language Models Hallucinate

What hallucination is, why it happens, and practical ways to reduce and catch it.

Generative AI 2 min read 21 Jul 2026