LLM Token Counter and API Cost Estimator
Paste a prompt to estimate its token count and API cost for the model you pick (GPT, Gemini, Claude and more).
Estimating a text's tokens and the cost of an LLM API call
The tool estimates the token count without an official tokenizer: characters ÷ 3.9, plus 0.3 token per code symbol and 0.8 per non-ASCII character (accents, emojis), with at least one token per word. The prompt cost is tokens ÷ 1,000,000 × the model's input price. Expect roughly 1 token per 4 characters of plain English; other languages and code need more.
Formulas
- Tokens = max(word count; ceiling of characters ÷ 3.9 + 0.3 × symbols + 0.8 × non-ASCII characters). Counted symbols are braces, brackets, parentheses, comparison signs, code punctuation, quotes and the hash sign.
- Prompt cost ($) = tokens ÷ 1,000,000 × input price per million.
- Cost of a same-length reply ($) = tokens ÷ 1,000,000 × output price per million, shown under the prompt cost; below $0.0001 both read "< $0.0001".
- Context usage = tokens ÷ the model's context window.
Recalculated examples
The English sample text (474 characters, 61 words, 36 symbols, no accented characters) gives 133 tokens, or $0.00002 with GPT-4o mini at $0.15 per million. An English text of 100,000 characters with 2,222 full stops gives 26,306 tokens: $0.066 of input with GPT-4o at $2.50 per million, and 20.6% of its 128,000-token window.
Limits
- This is a heuristic: each provider has its own tokenizer, and the gap can be large for code, non-Latin scripts and emojis. For an exact bill, rely on the API's own count.
- The list dates from early 2025: Claude 3.5 Sonnet was retired on 28/10/2025, Claude 3.5 Haiku on 19/02/2026, Gemini 1.5 Pro and Flash in late September 2025, and Gemini 2.0 Flash is scheduled for shutdown on 01/06/2026 at the earliest. Their prices are indicative only.
Sources and dates: OpenAI model pages (GPT-4o: $2.50 / $10, GPT-4o mini: $0.15 / $0.60 per million tokens); Anthropic "Model deprecations" page; Gemini API "Gemini deprecations" page and release notes (checked 14/10/2026).
Frequently Asked Questions
How many characters are in a token?
In plain English, about 4 characters, or roughly three quarters of a word; the tool uses 3.9 characters per token. Accents, code punctuation and emojis add tokens: the same sample text gives 152 tokens in French against 133 in English.
How much does a 10,000-token prompt cost with GPT-4o?
Input: 10,000 ÷ 1,000,000 × $2.50 = $0.025. If the model replies with 1,000 tokens, add 1,000 ÷ 1,000,000 × $10 = $0.01 at the output price. The tool shows the prompt cost and the cost of a reply as long as the text entered.
Is the token count shown exact?
No, it is a formula-based estimate without the models' real tokenizer. For an exact count, use OpenAI's tiktoken library or Anthropic's token-counting API endpoint; billing is based on the number the API returns in any case.
What happens if my text exceeds the context window?
The API rejects the request or truncates the history, depending on the service. The tool's bar caps at 100% and is calculated as tokens ÷ the model's window, for example 128,000 tokens for GPT-4o. Remember to leave room for the answer.
Is this tool really free?
Yes, all tools on Kristools are 100% free and accessible without registration.
Is my data protected?
Yes. All processing is performed directly and securely inside your browser. No personal data is sent to our servers.