# Token

> The atomic unit a model reads and writes. Roughly word-sized but not exactly. Context window size, cost, and latency all count tokens.

The atomic unit a [model](https://ai9k.vercel.app/en/model) reads and writes. Roughly word-sized but not exactly — common words are one token, rare or long ones split into several. [Context window](https://ai9k.vercel.app/en/context-window) size, cost, and latency are all counted in tokens.

Text becomes tokens via a tokenizer: a fixed vocabulary of tens of thousands of fragments, learned before [training](https://ai9k.vercel.app/en/training), that splits any input into a sequence of vocabulary entries. The model never sees characters or words — every piece of text is converted to tokens on the way in, and [next-token prediction](https://ai9k.vercel.app/en/next-token-prediction) produces output one token at a time on the way out.

As a rule of thumb, a token is about three-quarters of an English word, so a thousand tokens is roughly 750 words. Code is less predictable: common keywords and idioms tokenize compactly, while generated identifiers, hashes, base64 blobs, and minified output split into many tokens per "word". The pattern: text that appeared often in the tokenizer's source material gets short, efficient encodings; text that didn't gets chopped into many small pieces. A hash like `a3f9c2e1` never appeared anywhere, so it splits into many tokens, while `function` is one. This is why a small-looking file full of unusual strings can occupy a surprising share of the context window.

Tokens are the unit everything else is measured in. Cost is per token — providers bill [input tokens](https://ai9k.vercel.app/en/input-tokens) and [output tokens](https://ai9k.vercel.app/en/output-tokens) separately. Speed is tokens per second, since output is generated one token at a time. And the context window is a fixed number of tokens, so the token count of your files decides how much fits.

_Avoid:_ "word" — token boundaries don't match word boundaries, and tokens-per-second / tokens-per-dollar are the units that actually matter.

**Usage**

"How big is this prompt going to be?"

"Run it through the tokenizer — the schema's compact but the JSON keys are weird, so they'll split into more tokens than you think."

---

- Section 1 — The Model · Term 7 of 72
- Page: https://ai9k.vercel.app/en/token
- Learn step by step: https://ai9k.vercel.app/en/learn#/token
- On the map: https://ai9k.vercel.app/en?term=token
- JSON: https://ai9k.vercel.app/data/terms/token.json
- Mentioned in: [AI](https://ai9k.vercel.app/en/ai.md), [Model](https://ai9k.vercel.app/en/model.md), [Parameters](https://ai9k.vercel.app/en/parameters.md), [Training](https://ai9k.vercel.app/en/training.md), [Inference](https://ai9k.vercel.app/en/inference.md), [Effort](https://ai9k.vercel.app/en/effort.md), [Next-token prediction](https://ai9k.vercel.app/en/next-token-prediction.md), [Non-determinism](https://ai9k.vercel.app/en/non-determinism.md), [Model provider](https://ai9k.vercel.app/en/model-provider.md), [Model provider request](https://ai9k.vercel.app/en/model-provider-request.md), [Input tokens](https://ai9k.vercel.app/en/input-tokens.md), [Output tokens](https://ai9k.vercel.app/en/output-tokens.md), [Prefix cache](https://ai9k.vercel.app/en/prefix-cache.md), [Context](https://ai9k.vercel.app/en/context.md), [Context window](https://ai9k.vercel.app/en/context-window.md), [System prompt](https://ai9k.vercel.app/en/system-prompt.md), [Tool](https://ai9k.vercel.app/en/tool.md), [Tool result](https://ai9k.vercel.app/en/tool-result.md), [MCP](https://ai9k.vercel.app/en/mcp.md), [Contextual knowledge](https://ai9k.vercel.app/en/contextual-knowledge.md), [Attention relationship](https://ai9k.vercel.app/en/attention-relationship.md), [Attention budget](https://ai9k.vercel.app/en/attention-budget.md), [Attention degradation](https://ai9k.vercel.app/en/attention-degradation.md), [Smart zone](https://ai9k.vercel.app/en/smart-zone.md), [Primary source](https://ai9k.vercel.app/en/primary-source.md), [AGENTS.md](https://ai9k.vercel.app/en/agentsmd.md), [Progressive disclosure](https://ai9k.vercel.app/en/progressive-disclosure.md), [Context pointer](https://ai9k.vercel.app/en/context-pointer.md), [Skill](https://ai9k.vercel.app/en/skill.md)
- Previous: [Effort](https://ai9k.vercel.app/en/effort.md)
- Next: [Next-token prediction](https://ai9k.vercel.app/en/next-token-prediction.md)

Every term page has a markdown copy: add .md to its address.
