AI Token Counter
Estimate the number of tokens in your text for GPT-4, Claude, Gemini, and other LLMs. Useful for staying within context limits.
Did this tool work for you?
How to use this calculator
Most English text tokenizes at roughly 4 characters per token. This is an approximation — actual counts vary by tokenizer, language, and content type.
- 1
Paste or type the text you want to count into the text area.
- 2
Select the model family you are targeting from the dropdown.
- 3
Read the estimated token count and percentage of the context window used.
Frequently asked questions
Exactly how does this tool count tokens?
Estimated tokens = the number of characters in the text box ÷ 4, rounded up. Characters are the string length, including spaces and line breaks. No tokenizer is run, so the number is a heuristic rather than a count.
Does choosing a model family change the token estimate?
No. The dropdown changes only the context window used for the percentage: 128,000 for GPT-4 / GPT-3.5, 200,000 for Claude, 1,000,000 for Gemini 1.5 and 32,000 for Llama / open source. The estimated token count is identical for every selection.
How accurate is the estimate?
It is a rule of thumb for English prose and the tool does not measure its own error. Real tokenizers differ by model and by language, and code, numbers and URLs behave differently again. For billing or limit checks, use the provider’s own tokenizer or the token counts returned by the API.
Why can the count be far off for Chinese, Japanese or Arabic text?
Because the tool counts characters and divides by four whatever the script. As an example, 1,000 Chinese characters are reported as 250 tokens. Real tokenizers do not treat every script like English text, so counts for these languages can differ substantially from the estimate.
What does the "% of context used" line mean?
Estimated tokens ÷ the selected window × 100. It does not reserve space for the model’s reply, so a text at 90 percent may leave little room for an answer. The window sizes are figures built into this tool and vendors change them, so verify on the model page.
How are words and pages calculated?
Words are runs of non-whitespace characters, split on any spaces, tabs or line breaks. Pages = estimated tokens ÷ 500, a convention in the code that does not correspond to a real page layout.
What happens when the text is longer than the context window?
The tool just reports a percentage over 100, for example 117.19% for a 600,000-character text against the 128,000 window. What a model or API does with oversized input depends on the provider: it may return an error or require you to trim the input.
Why does the default text give 26 tokens?
The preloaded sample has 101 characters. 101 ÷ 4 is 25.25, which rounds up to 26, and the sample contains 18 words.
Token counter: a characters-divided-by-four estimate with context window usage
What the counter calculates
Tokens = characters ÷ 4, rounded up. The tool also counts characters (the string length, with spaces and line breaks included) and words (runs of non-whitespace), shows the estimated tokens as a share of a context window, and converts tokens to pages at 500 tokens per page. Nothing here runs a real tokenizer, which means the result is a quick sizing aid rather than the number a provider will bill. It is most useful for checking whether a block of English text is in the right range before you test it with an official tool.
What the model dropdown changes
Only the window changes. The estimated token count is the same whichever family you select, because the code applies one ratio to all of them. The windows are figures built into this tool and vendors change them, so verify on the provider’s model page.
| Dropdown option | Window (tokens) |
|---|---|
| GPT-4 / GPT-3.5 (OpenAI) | 128,000 |
| Claude (Anthropic) | 200,000 |
| Gemini (Google) | 1,000,000 |
| Llama / Open Source | 32,000 |
Worked examples
Each row was produced by running the counter. The long texts were runs of a single repeated letter, so only their length matters.
| Text | Estimated tokens | Result |
|---|---|---|
| Default sample sentence, 101 characters, 18 words | 26 | 0.02% of 128,000; 0.1 pages |
| 10,000 characters | 2,500 | 5.0 pages; 1.95% of 128,000, 1.25% of 200,000, 7.81% of 32,000 |
| 600,000 characters | 150,000 | 300.0 pages; 117.19% of 128,000, 468.75% of 32,000 |
| 1,000 Chinese characters (two characters repeated 500 times) | 250 | 0.20% of 128,000; 0.5 pages |
Why the last example is a warning
The tool reports 250 tokens for 1,000 Chinese characters because it counts characters without regard to script. Real tokenizers handle scripts differently from English, so a count made this way can differ substantially for Chinese, Japanese, Korean or Arabic, and for source code, tables or text full of numbers and URLs. Use this page for quick sizing of English prose and use the provider’s tokenizer for anything that must be exact, such as a hard length limit or a cost estimate you intend to publish.
Using the percentage
The percentage compares estimated input tokens with the window and reserves nothing for the reply. The 600,000-character run shows 117.19% of the 128,000 window, so that text would not fit even before any answer. As a rule, once a text approaches half of a window, subtract room for the output and for system instructions before deciding. The pages line assumes 500 tokens per page, a convention in the code that does not match any real page layout, so use it only for rough orientation.
Learn more from an authoritative source:
OpenAI Platform DocsAI Prompt Cost Calculator
Calculate the cost of an AI API call based on input/output tokens and model pricing.
Words to Tokens Converter
Convert between words, characters, tokens, and pages for AI models and content planning.
AI API Budget Calculator
Plan your monthly AI API budget based on usage volume, model selection, and request patterns.
Context Window Checker
Check if your text fits within the context window of popular AI models. Paste your prompt and see which models can handle it.
LLM Cost Comparison Calculator
Compare monthly token costs across major LLM models — GPT-4o, Claude, Gemini, and more — for your specific workload.
Embedding Cost Calculator
Calculate monthly and annual costs of generating text embeddings with OpenAI or Cohere models.
Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →