Free tool
Gemini token counter
Approximate token counts for Gemini 3.x, 2.5 Pro, Flash, and Flash-Lite. Google's tokenizer isn't open source, so this uses a char-based estimate within ±10%.
Gemini
~0
approx (±10%)
Characters
0
Words
0
What is a token?
Google's Gemini models use SentencePiece with a proprietary vocabulary that is not published. The only way to get an exact token count is to call the generativelanguage countTokens endpoint.
This tool uses a character-based heuristic (chars ÷ 4) that's accurate to within about ±10% for typical English prose. If you need an exact count for production budgeting, use Google's free countTokens API endpoint.
Important: Gemini 2.5 Pro has a long-context pricing tier that kicks in above 200,000 input tokens. Costs double above that threshold. The Calcis /estimator and /calculators automatically handle this, but this pure counter does not.
How tokens relate to characters
| Text | Characters | ~Tokens |
|---|---|---|
| Hello | 5 | 1 |
| Hello, world! | 13 | 4 |
| The quick brown fox jumps over the lazy dog. | 44 | 11 |
| function add(a, b) { return a + b; } | 36 | 13 |
| pneumonoultramicroscopicsilicovolcanoconiosis | 45 | 11 |
| 🎉🚀✨ emoji counts are surprising | 30 | 12 |
Frequently asked
Why is the Gemini count only approximate?
Google doesn't publish their tokenizer. An offline counter has to use a heuristic; the only exact count comes from calling countTokens on Google's API. For a browser-side counter, chars ÷ 4 is a practical compromise.
How accurate is the heuristic for Gemini?
About ±10% for English prose. Code runs slightly under-counted; CJK and emoji are much less accurate. For safety-critical cost budgeting, use Google's countTokens API for an exact figure.
What is Gemini's long-context pricing tier?
Gemini 2.5 Pro charges base rates ($1.25 input / $10 output per 1M) up to 200K input tokens, and double rates ($2.50 / $15) above that. Gemini 2.5 Flash has a similar tier. If your prompt might cross 200K, factor that in — this counter doesn't.
How do I get an exact Gemini token count?
Call Google's countTokens endpoint with the model ID. It's free and returns the exact count. The Calcis /estimator does this automatically when you paste a prompt.
Which Gemini models use which tokenizer?
All current Gemini models (3.x, 2.5, 1.5) use the same SentencePiece tokenizer. The token counts across these models will be identical for the same text; only the pricing differs.
Know the tokens? Get the cost.
Once you've got a token count, the estimator turns it into an exact dollar forecast across every model.