AI glossary · Tokens and cost
What does token mean in AI?
Also called: LLM token, AI token
Definition
A token in AI is the unit of text a language model reads and writes, usually a whole word, part of a word or a punctuation mark, which the model sees only as a number from its vocabulary.
Explained
How do tokens work in a language model?
This is the short definition; the full guide to tokens goes deeper. Before a model sees your prompt, a tokenizer cuts the text into pieces from a fixed vocabulary and swaps each piece for its ID number. The model then predicts one new token at a time, and the tokenizer turns the IDs back into text. The token is the piece; the ID is what the model actually processes.
Common words get a token of their own, usually with the space before them included. Rare words, names and code are built from several pieces, and punctuation is usually separate. Anthropic puts a token at about 3.5 English characters on earlier Claude models, and OpenAI’s tiktoken notes about 4 bytes per token on average.
Tokens are the unit of everything you pay for and every limit you hit: API prices are per million tokens, and a model’s context window and output limit are counted in tokens. Each model family has its own tokenizer, so the same text gives a different count on Claude, GPT and Gemini.
Example
A 7-word sentence, 11 tokens
OpenAI’s o200k_base tokenizer, used by GPT-4o and the GPT-5 models, splits the sentence below into 11 tokens. “Chatbots” becomes two pieces, “don’t” splits into “␣don” and “’t”, and the semicolon and full stop are tokens of their own.
Count your own text with the token counter, which shows the split for several models side by side. For why other languages, numbers and code cost more tokens, read what is a token in AI.
| Result | |
|---|---|
| Pieces | Chat bots ␣don ’t ␣read ␣words ; ␣they ␣read ␣tokens . |
| Token IDs | 14065 91601 1700 1573 1729 6391 26 1023 1729 20290 13 |
| Words | 7 |
| Tokens | 11 |
␣ marks a space that belongs to the token. Measured with gpt-tokenizer 4.0 (o200k_base) on 2026-10-11.
Cost and quality
Why do tokens matter for cost and limits?
Every cost and limit is counted in tokens, so a word count is only an estimate. Code, JSON and many languages other than English use more tokens per word than English prose, and output tokens usually cost several times as much as input tokens.
The count also depends on the model. Anthropic says Claude 4.7 and later models use a newer tokenizer that produces about 30% more tokens for the same text than earlier Claude models, so recount when you switch.
Don’t mix up
Are AI tokens the same as words or crypto tokens?
- Tokens vs words
- A token is not a word. In the example, 7 words became 11 tokens. In English prose a token averages roughly three quarters of a word, but code, numbers and other languages are denser.
- AI tokens vs access tokens and crypto tokens
- An access token (for example from OAuth) is a credential that proves who you are, and a crypto token is a digital asset. When an AI price says “per million tokens”, it means pieces of text.
- Text tokens vs image tokens
- Images are billed in tokens too, but they are counted from pixels, not text: Claude charges one token per 28 × 28-pixel patch, for example. See how many tokens an image is.
FAQ
Questions people ask
What do 1 million tokens mean in AI?
It is the unit providers price by: rates are quoted per million input and output tokens. In English prose, a million tokens is about 866,000 words on OpenAI’s o200k_base tokenizer (our measurement) and about 555,000 words on current Claude models (Anthropic’s figure). Code and most other languages fit fewer words. The tokens to words converter works out other sizes.
Can images and audio be tokens?
Yes. Multimodal models turn images and audio into tokens too, and bill them like text. Google’s Gemini docs, for example, count a small image as 258 tokens, split larger images into tiles of 258 tokens each, and count audio at 32 tokens per second. Each provider has its own rules, so check the model’s documentation before estimating image or audio costs.
Go deeper
Try it and read more
- Free toolAI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.
- Free toolTokens to Words ConverterConvert between tokens, words and pages.
- Free toolLLM API Cost CalculatorEstimate per-request, daily and monthly API costs.
- Guide · 10 min readAI tokens explained: what a token is, how it is counted, and what it costsAI tokens explained with real examples: how LLMs split text into tokens, how counts are calculated, and why tokens set your API cost and context limit.
- Guide · 16 min readHow to count tokens in Python and JavaScript (OpenAI, Claude, Gemini, Qwen)How to count tokens in Python and JavaScript: tiktoken, gpt-tokenizer, Hugging Face tokenizers, and the Claude and Gemini count-token endpoints.
Related