AI Token Counter
Token count and input cost
Paste text above to see how it splits into tokens.
How tokens are counted
A token is the unit a language model reads and bills. Models split text with a byte-pair encoding (BPE) vocabulary, so one token can be a whole word, part of a word, one character or a few bytes. "Hello world" is 2 tokens and "The quick brown fox jumps over the lazy dog." is 10 tokens in both OpenAI vocabularies.
The count depends on the vocabulary. The 16-character Chinese sentence 今天天气很好,我们去公园散步吧。 is 20 tokens in cl100k_base (GPT-4, GPT-4 Turbo, GPT-3.5 Turbo) and 12 tokens in o200k_base (GPT-5, GPT-4.1, GPT-4o, o1, o3). Paste the same text and switch models to compare.
Exact and estimated counts
- GPT models: exact. The page runs the cl100k_base or o200k_base vocabulary and shows each token with its ID and byte length.
- Claude: estimated as the o200k_base count × 1.04, because Anthropic does not publish its tokenizer.
- Gemini: estimated from character types, at about 0.27 tokens per Latin character, 0.6 per Chinese character, 0.55 per Japanese kana or Korean Hangul character and 1.5 per emoji.
- Llama, Mistral and DeepSeek: estimated from the cl100k_base count multiplied by 1.0, 1.05 and 0.95.
- Cost: input tokens × input price per million tokens, plus expected output tokens × output price per million tokens.
- Fits: input tokens plus expected output tokens are within the model's context window.
Frequently asked questions
How many tokens is a word?
Common English words are usually one token each, including the space before them. Long or rare words split into several tokens, and punctuation is a separate token. The 9-word sentence "The quick brown fox jumps over the lazy dog." is 10 tokens; "Large language models are billed per token, and input and output are priced separately." is 14 words and 16 tokens. OpenAI's rule of thumb for English is about 4 characters or 3/4 of a word per token, so 1,000 tokens is roughly 750 words.
How many tokens is a Chinese character?
It depends on the tokenizer. In our samples, o200k_base (GPT-4o and later) used about 0.75–1 token per Chinese character and cl100k_base (GPT-4, GPT-3.5) about 1.25–1.4. Common words take fewer tokens in o200k_base: 人工智能 is 2 tokens there and 5 in cl100k_base. Rare characters such as 饕餮 can take 2–3 tokens each. The Gemini estimate on this page uses 0.6 tokens per Chinese character.
How do I count Claude tokens exactly?
Call Anthropic's token counting endpoint, POST /v1/messages/count_tokens (client.messages.countTokens in the TypeScript SDK, client.messages.count_tokens in Python). It takes the same model, system prompt, messages and tools as a Messages request and returns input_tokens. The Claude figure on this page is an o200k_base × 1.04 estimate. Claude Opus 4.7 and later use a newer tokenizer that can produce up to about 35% more tokens for the same text, so the estimate can run low for those models.
Why does the API report more tokens than this page?
This page counts the text you paste. A chat API request also counts the tokens that wrap each message and its role, the system prompt, tool definitions and any images or files. For models marked Estimate, the count on this page is an approximation.
How is the API cost calculated?
Cost = input tokens × input price ÷ 1,000,000 + output tokens × output price ÷ 1,000,000. For example, 2,000 input tokens at $2.50 per million and 500 output tokens at $10 per million cost $0.005 + $0.005 = $0.01. The page does not apply cached-input or batch discounts. Prices are entered by hand. The cost panel shows when they were last updated and links to the selected model's pricing page.
What is a context window?
The context window is the maximum number of tokens a model can handle in one request, with the input and the generated output counted together. The bar shows how much of it your text uses. The Fits column in the comparison table adds your expected output tokens. A request over the limit is rejected or truncated by the API.
Related tools
Related articles
- One Emoji, Eight Characters: What Word Counters Get Wrong About Length
'👨👩👧'.length is 8, Array.from gives 5, a grapheme count gives 1. The three layers of character in JavaScript, and why word counters need Intl.Segmenter.