How to use it
- Paste a prompt, document or code into the box. Everything runs in your browser; the first time, the tokenizer files are downloaded (under 2 MB compressed), after which results are instant.
- The four numbers at the top are the exact token counts for OpenAI's two tokenizers, the number of characters and the size in UTF-8 bytes.
- Enter how many output tokens you expect. The table lists each model's input cost, total cost with output, and how much of the context window input plus output would take. Anything that exceeds the window or the model's output limit is shown in red.
- Open "Show each token" to see how the text is split, which explains why prose, code and non-English text of the same length produce very different counts.
Exact counts, approximations and cost
What is exact
OpenAI publishes its tiktoken tokenizer and vocabularies. According to the model table in the official repository, GPT-4o, GPT-4.1, GPT-4.5, GPT-5 and o1, o3 and o4-mini use o200k_base, while GPT-4 and GPT-3.5 Turbo use cl100k_base. This tool uses the same vocabularies locally and matches the Python tiktoken library, so those two numbers are exact.
What is approximate
At the time of checking, that table does not yet list the GPT-6 family, and Anthropic and Google do not publish the tokenizers of current Claude and Gemini models. Anthropic's pricing notes say Claude 4.7 and later use a newer tokenizer that produces roughly 30% more tokens for the same text; Google says a Gemini token is about 4 characters and 100 tokens are about 60 to 80 English words. The table therefore uses the o200k_base count for these models and marks it with ≈. For exact figures call the provider's counting API, such as Anthropic's token counting endpoint (free, with rate limits) or Gemini's countTokens.
Chinese models
The cost table also lists models from DeepSeek, Alibaba Cloud (Qwen), Moonshot AI (Kimi) and Zhipu AI, priced in Chinese yuan as on their official pages; their token counts are approximations too. The providers' own rules of thumb: DeepSeek says one Chinese character is about 0.6 tokens and one English character about 0.3; Zhipu puts GLM at about 1 token per 1.6 Chinese characters; Kimi says one token is roughly 1.5 to 2 Chinese characters in typical text. DeepSeek charges a peak and an off-peak price, with off-peak at half; to compare every provider in one currency and by time of day, use the LLM API price comparison on this site.
Cost
Prices are per million tokens at each provider's standard rate, without caching or batch discounts. Two details matter. First, long prompts can reprice the whole request: according to OpenAI's pricing, when a GPT-6 family request has more than 272K input tokens, the whole request is billed at 2x for input and 1.5x for output; Gemini 3.1 Pro Preview also moves to a higher price above 200K tokens (Google pricing). Claude has one price across its 1M-token window. Second, Gemini 3.8 Flash costs $0.75 input and $3.75 output through 31 December 2026, then $1.50 and $7.50 from 1 January 2027; the tool switches automatically by your computer's date.
Why non-English text varies so much
Newer vocabularies contain more whole words from other languages. The Chinese sentence 人工智能正在改变世界。 ("AI is changing the world.") is 12 tokens with cl100k_base but only 6 with o200k_base. Rules of thumb such as "four characters per token" come from English and are unreliable for other languages and for code.
Your text stays on this computer
In November 2025 the security firm watchTowr reported that two popular online JSON formatters listed users' saved content on a public "Recent Links" page; the researchers collected more than 80,000 saved submissions containing passwords, cloud keys and access tokens, and a decoy key they planted was tried by someone 48 hours later. Prompts often contain customer data too. This tool tokenizes and calculates entirely in your browser; nothing is uploaded or stored, and it keeps working if you go offline after the page loads.
Examples
| Text | o200k_base | cl100k_base |
|---|---|---|
| hello world | 2 | 2 |
| The quick brown fox jumps over the lazy dog. | 10 | 10 |
| 你好,世界 (Hello, world) | 3 | 6 |
| 人工智能正在改变世界。 | 6 | 12 |
| {"name": "Alice", "age": 30} | 12 | 12 |
A 100,000-token document sent to GPT-6.1 Sol with 2,000 tokens of output costs $0.20 for input and $0.02 for output, $0.22 in total. At 300,000 input tokens the request passes 272K and is billed at the long-context rate: $1.20 for input. The same 900,000 input tokens on Claude Opus 5.5 cost $3.60 at its single rate. Claude Haiku 4.5 has a 200,000-token window, so 190,000 input plus 20,000 output does not fit.
Limits
- Text only. Images, audio, PDFs and tool definitions also use tokens, counted under each provider's rules.
- Chat APIs add a few formatting tokens per message, and system prompts and tool definitions count as input, so the billed amount is a little higher than for the bare text.
- Reasoning models bill their thinking tokens as output and you cannot know them in advance, so leave headroom in the expected output.
- Token counts for GPT-6, Claude and Gemini are approximations, as explained above.
- Prices and windows change; the table reflects the check date.
Frequently asked questions
How many tokens is a word?
In English, common words are usually one token each and rarer words split into several. Other languages and code vary much more.
Can Claude tokens be counted exactly?
Not locally. Anthropic does not publish the current tokenizer; use its token counting API. This tool gives an approximation.
Which tokenizer does GPT-5 use?
o200k_base, according to the model table in OpenAI's tiktoken repository, so this tool counts it exactly.
Why does the cost jump above 272K tokens?
OpenAI bills GPT-6 family requests with more than 272K input tokens at 2x input and 1.5x output for the whole request.
Is my text uploaded?
No. Once the tokenizer is in your browser, everything is calculated locally.
Sources and further reading
- OpenAI: tiktoken model-to-encoding table (model.py)
- OpenAI: API pricing
- OpenAI: GPT-6.1 Sol model page
- Anthropic: Claude pricing
- Anthropic: Models overview
- Anthropic: Token counting
- Google: Gemini API pricing
- Google: Understand and count tokens
- DeepSeek: token usage (in Chinese)
- Zhipu AI: API pricing (in Chinese)
- Kimi: model pricing (in Chinese)
- watchTowr Labs: Stop Putting Your Passwords Into Random Websites