LLM token counter
Paste a prompt, document or code. See its token count per tokenizer family and what it costs as input on every model. Everything runs in your browser.
The exact OpenAI tokenizer (about 1 MB) loads when you start typing.
This text is largely Korean, Japanese or Chinese. CJK text uses several times more tokens per character than English, and the gap between tokenizers is larger than for English, so treat non-OpenAI numbers as rough.
Cost of this text as input
| Model | Tokens | Once | × 1,000 |
|---|
Input only, standard price, no caching or batch discount. Long-context rates apply automatically when the text crosses a model's threshold. For output, caching and agent loops use the calculator.
Provider-specific counters with input and output cost, tokenizer facts and the official exact-count API call: Claude token counter · Gemini token counter · OpenAI token counter.
How each count is made
| Tokenizer family | Ratio to o200k | Basis |
|---|---|---|
| OpenAI (o200k_base) exact for GPT-5.x | 1.00× | Exact count with o200k_base, the encoding tiktoken maps to GPT-5.x models. OpenAI has not published the tokenizer for GPT-6 models, so for those it is the closest public reference. Source |
| Claude 4.7 and later | 1.30× | Anthropic: Claude 4.7 and later models use a newer tokenizer that "produces approximately 30% more tokens for the same text". Applied on top of the Claude 4.6 estimate. Source |
| Claude 4.6 and earlier | 1.00× | Assumption: about the same as o200k_base. Anthropic does not publish its tokenizer; use the free token counting endpoint for exact numbers. Source |
| Gemini | 1.00× | Assumption: about the same as o200k_base. Google's own rule of thumb is about 4 characters per token for English; use the countTokens API for exact numbers. Source |
| xAI, DeepSeek, Mistral | 1.00× | Assumption: about the same as o200k_base. These providers do not publish a browser tokenizer; their usage reports are the source of truth. |
Only the OpenAI count is exact. The others are planning estimates: a provider's own tokenizer can count the same text noticeably differently, especially for code, non-English text and unusual formatting. If the cost decision is close, count a sample with the provider's own token-counting API.
Tokenizers by provider
Every provider bills by its own tokenizer, so the same text can be a different number of tokens on each. What each one officially documents:
| Provider | Tokenizer | Exact count | Official rule of thumb |
|---|---|---|---|
| OpenAI | Public. GPT-5.x models map to the o200k_base encoding in tiktoken; this page counts with it exactly. | tiktoken (Python) or OpenAI's web tokenizer tool; the API response reports usage. | About 4 characters or 0.75 words per token for English text. Rule of thumb · tiktoken model map |
| Anthropic | Not published. Claude Opus 4.7 and later (including Fable 5 and 5.1) use a newer tokenizer that produces approximately 30% more tokens for the same text than earlier models; the exact increase depends on the content. | Token counting endpoint: free, rate-limited per usage tier, counts under the tokenizer of the model you pass. Anthropic calls the result an estimate that may differ from billed usage by a small amount. | No characters-per-token rule published. Token counting |
| Google (Gemini) | Not published as a library. | countTokens API (count_tokens in the SDKs) with the same input as the request. | About 4 characters per token; 100 tokens is about 60-80 English words. Images up to 384 px on both sides count as 258 tokens; larger images are tiled into 768 × 768 tiles of 258 tokens each. Audio: 32 tokens per second. Understand and count tokens |
| DeepSeek | Offered as a downloadable demo tokenizer package for offline estimates. | The usage field returned by the API is the source of truth. | 1 English character ≈ 0.3 tokens; 1 Chinese character ≈ 0.6 tokens. DeepSeek notes the ratio varies by model. Token & token usage |
| Mistral AI | Open source. Mistral documents several tokenizer versions; V3-Tekken is based on tiktoken, earlier versions on SentencePiece. The implementation is in the mistral-common library. | mistral-common locally; the API response reports usage. | No characters-per-token rule published. Tokenization guide |
| xAI | No tokenizer documentation found in xAI's public API docs. | The usage object in each API response (input_tokens, output_tokens). | No characters-per-token rule published. API reference |
Checked against the linked official documentation on 2026-10-29.
Tokens per word: quick conversions
Applying the official English rules of thumb (OpenAI: 0.75 words per token; Google: 60-80 words per 100 tokens):
| English words | Tokens (OpenAI rule) | Tokens (Google rule) | Input cost at $2.00 / 1M |
|---|---|---|---|
| 100 | 133 | 125-167 | $0.00027 |
| 1,000 | 1,333 | 1,250-1,667 | $0.0027 |
| 10,000 | 13,333 | 12,500-16,667 | $0.03 |
| 100,000 | 133,333 | 125,000-166,667 | $0.27 |
Cost column uses the OpenAI-rule token count and Claude Sonnet 5.5's input price as a reference point. By the same rule, 1M tokens is about 750,000 English words. For non-English text, DeepSeek publishes 0.6 tokens per Chinese character versus 0.3 per English character, and the measured samples below show the gap on OpenAI's tokenizer.
CJK vs Latin text
Token counts depend heavily on the script. Counts below are exact o200k_base results for short samples:
| Sample | Characters | Tokens | Characters per token |
|---|---|---|---|
| English prose | 148 | 31 | 4.77 |
| JavaScript | 102 | 28 | 3.64 |
| Korean | 74 | 40 | 1.85 |
| Japanese | 53 | 38 | 1.39 |
| Chinese | 35 | 25 | 1.40 |
The common rule of "about 4 characters per token" fits English, but in these samples Korean, Japanese and Chinese average 1.5 characters per token. Budget non-English workloads with a real count.
FAQ
Is the OpenAI count exact?
It is an exact o200k_base count, computed in your browser with the open-source gpt-tokenizer library. o200k_base is the encoding tiktoken maps to GPT-5.x models. OpenAI has not published the tokenizer for GPT-6 models, and chat formatting adds a few tokens per message, so treat API usage numbers as final.
Why are Claude counts higher for newer models?
Anthropic states that Claude 4.7 and later models use a newer tokenizer that produces approximately 30% more tokens for the same text. The counter applies that ratio. For exact numbers, use Anthropic's free token counting endpoint.
Is my text sent anywhere?
No. Counting and cost calculation run entirely in your browser. The tokenizer file is downloaded once from this site and nothing you paste is uploaded.
How many tokens is a word?
OpenAI's rule of thumb is about 0.75 words per token for English (about 1,333 tokens per 1,000 words). Google's is 60-80 English words per 100 tokens (1,250-1,667 tokens per 1,000 words). Other languages, code and unusual formatting use more tokens per word, so count real text when the budget matters.
How do I get an exact token count for Claude or Gemini?
Use the provider's own counting API: Anthropic's token counting endpoint (free, rate-limited, counts under the tokenizer of the model you name) or Gemini's countTokens method. Neither tokenizer is published for offline use, so the numbers on this page for those models are estimates.
What does it cost to send this text?
Paste it above: the table multiplies the token estimate for each model by that model's input price per 1M tokens (verified 2026-11-17) and by the number of repeats you choose. Output tokens are billed separately and usually at a higher price; use the calculator for the full request.
Why does Korean, Japanese or Chinese text use more tokens?
Tokenizer vocabularies are built mostly from English and code, so CJK text splits into more pieces per character of meaning. In the samples on this page, English runs about 4.8 characters per token and Korean about 1.9.
Tokenizer: gpt-tokenizer 3.4.0 (MIT, license), served from this site.