Tokens and the context window
Part 1 · The basics3 minModels read in small pieces, and only so many fit at once. Type a sentence to see it split, then watch a page fill the window and get cut.
Models read in pieces
A model reads neither letters nor whole words. It reads tokens: small pieces of text.
“Is the Hario V60 in stock?” is about nine tokens. Everything a model reads and writes is counted this way.
- Token
- The unit a model reads and writes in: a word, part of a word, a number or a sign.
Why it matters. The token count decides how much of a page an agent can take in.
Words break into parts
Common words are usually one token. Long, rare or made-up words break into several. Numbers and symbols often become a piece each.
In English, a token is on average about four characters, or three quarters of a word.
Tokens are also how use is priced and limited: a model’s price and its reading limit are both counted in them.
Why it matters. A site in Hebrew or Arabic usually costs more tokens per sentence than the same site in English, so it reaches the limits sooner.
Try it
Type in the box on the stage and watch your text break into pieces.
The split shown is a rough one, made by rule. A real tokenizer learned its pieces from data, so its pieces differ, but for English the count lands in the same range.
Watch the count as you type. Spaces, capitals and punctuation all change where the pieces fall.
Why it matters. Product codes, long addresses and numbers cost more pieces than plain words. Pages full of them fill up faster.
The context window
All a model can consider for one answer must fit in its context window: a fixed number of tokens.
At the start of a task it holds only the assistant’s instructions and the person’s question. Plenty of room.
- Context window
- The most text a model can have in front of it at once, counted in tokens.
Why it matters. A page shares the window with the question, the results and every other page.
It all shares one window
As the agent works, its window fills: the search results, then the text of the page it opened, then the next page.
All of it shares the same space. A bigger page leaves less room for the next one, and for the answer.
Agents cope by cutting: they trim pages, keep only the parts that look relevant, or stop reading early.
Why it matters. A lighter page leaves room for the agent to read more of the site, and gives it less reason to stop early.
A page is mostly markup
What a site sends is HTML: the words, plus the markup around them, menus, footers, scripts and styles.
Most of a modern page’s HTML is not words a reader would see. Sent to a model as it is, all of it costs tokens.
The product name can be a few tokens among thousands.
Why it matters. The words that matter can be a small part of what a server sends. The rest still has to be fetched, and often counted.
When it does not fit
If a page is bigger than the room left, the rest is cut. The model simply never sees it.
Many fetch tools also stop after a set amount of text, before the model is involved at all. Whatever comes after that point might as well not be on the page.
A cut does not show. The agent does not know what it missed, so it answers as if the page ended there.
Why it matters. Put the answer early. Whatever comes after a long menu or a banner is the first thing to be cut.
Every token costs
Each token takes time to read and money to process. Agents and the companies behind them have every reason to prefer short, clean pages.
A page whose main content comes early, as plain text, is cheaper and faster to read, and more likely to be read in full.
Why it matters. A short, text-first page is read in full. A heavy one, in part or not at all.