Gemini token counter
Paste a prompt, document or code to see its token count and what it costs as input and as output on each Gemini model. Counting runs in your browser.
Estimate, not an exact count. Google does not publish the Gemini tokenizer as a library for browsers, so this page counts your text with OpenAI's public o200k_base tokenizer and assumes Gemini is about the same. Google's own rule of thumb (about 4 characters per token for English) points the same way, but the two can differ noticeably for code and non-English text. For an exact number, call countTokens as shown below.
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 on Gemini models
| Model | Tokens | As input | As output | × 1,000 |
|---|
Standard prices, no caching or batch discount. "As output" is what the same number of tokens costs if the model generates it. Long-context rates apply automatically when the text crosses a model's threshold. Full requests with caching and agent loops: calculator.
Gemini tokenizer facts
| Tokenizer | Not published as a library. Google's rule of thumb: a token is about 4 characters; 100 tokens are about 60-80 English words. Source |
|---|---|
| Exact count | models.countTokens returns totalTokens for the input only (plus cachedContentTokenCount and per-modality details). Output tokens are reported in the response usage after generation. Source |
| Price of counting | The Gemini Developer API docs do not state a price or rate limit for countTokens. Google Cloud's Vertex AI docs state there is no charge for CountTokens and a maximum of 3,000 requests per minute. Source |
| Images | Images up to 384 px in both dimensions count as 258 tokens. Larger images are tiled into 768 × 768 tiles of 258 tokens each. Source |
| Audio | 32 tokens per second. Source |
| Context window | Gemini 4 models share one 1,048,576-token window across input, thinking and output. Gemini 3 and 2.5 models have separate input (1,048,576) and output (65,536) budgets. Source |
Checked against the linked official documentation on 2026-10-30.
Get the exact count from the official API
cURL
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:countTokens" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "The quick brown fox."}]}]}'
# → {"totalTokens": ...}
Python (google-genai)
from google import genai
client = genai.Client()
result = client.models.count_tokens(
model="gemini-3.8-flash",
contents="The quick brown fox jumps over the lazy dog.",
)
print(result.total_tokens)
countTokens counts the input you send, including images, audio and files, with the same content structure as generateContent. Official documentation
What Gemini tokens cost
Cost of a given number of billed tokens on each model at standard rates (prices verified 2026-11-17):
| Model | 1K in | 1K out | 10K in | 10K out | 100K in | 100K out | Per 1M in / out |
|---|---|---|---|---|---|---|---|
| Gemini 4 Carbon | $0.0020 | $0.01 | $0.02 | $0.10 | $0.20 | $1.00 | $2.00 / $10.00 |
| Gemini 4 Argon | $0.0020 | $0.01 | $0.02 | $0.10 | $0.20 | $1.00 | $2.00 / $10.00 |
| Gemini 4 Hydrogen | $0.0015 | $0.0075 | $0.01 | $0.07 | $0.15 | $0.75 | $1.50 / $7.50 |
| Gemini 3.8 Flash | $0.00075 | $0.0037 | $0.0075 | $0.04 | $0.07 | $0.38 | $0.75 / $3.75 |
| Gemini 3.6 Flash | $0.00075 | $0.0037 | $0.0075 | $0.04 | $0.07 | $0.38 | $0.75 / $3.75 |
| Gemini 3.1 Pro (Preview) | $0.0020 | $0.01 | $0.02 | $0.12 | $0.20 | $1.20 | $2.00 / $12.00 |
| Gemini 3.5 Flash-Lite | $0.00030 | $0.0025 | $0.0030 | $0.03 | $0.03 | $0.25 | $0.30 / $2.50 |
| Gemini 3.1 Flash-Lite | $0.00025 | $0.0015 | $0.0025 | $0.01 | $0.03 | $0.15 | $0.25 / $1.50 |
| Gemini 2.5 Flash | $0.00030 | $0.0025 | $0.0030 | $0.03 | $0.03 | $0.25 | $0.30 / $2.50 |
Long-context pricing: Gemini 3.1 Pro (Preview) bills the whole request at 2× input and 1.5× output once the prompt exceeds 200,000 tokens. The output columns above assume a short prompt.
Announced price changes: Gemini 4 Carbon moves to $4.00 / $20.00 per 1M on 2026-12-01; Gemini 4 Argon moves to $4.00 / $20.00 per 1M on 2026-12-01; Gemini 3.8 Flash moves to $1.50 / $7.50 per 1M on 2027-01-01; Gemini 3.6 Flash moves to $1.50 / $7.50 per 1M on 2027-01-01. See price changes.
Per-model details: Gemini 4 Carbon, Gemini 4 Argon, Gemini 4 Hydrogen, Gemini 3.8 Flash, Gemini 3.6 Flash, Gemini 3.1 Pro (Preview), Gemini 3.5 Flash-Lite, Gemini 3.1 Flash-Lite, Gemini 2.5 Flash. Compare with other providers in the pricing table.
FAQ
Is this Gemini token count exact?
No. Google does not publish the Gemini tokenizer for browser use, so the count here is the exact o200k_base count of your text, assumed to be about the same on Gemini. Google's rule of thumb is about 4 characters per token for English. For an exact number, call countTokens.
How do I count Gemini tokens exactly?
Call models.countTokens (count_tokens in the google-genai SDK) with the same contents you will send. It returns totalTokens for the input only. After a request, the response usage reports input, output, thinking and cached tokens.
Is Gemini countTokens free?
The Gemini Developer API documentation does not state a price or rate limit for countTokens. Google Cloud's Vertex AI documentation says CountTokens has no charge and a maximum of 3,000 requests per minute.
How many tokens is an image or audio clip in Gemini?
An image up to 384 pixels on both sides is 258 tokens; larger images are split into 768 × 768 tiles of 258 tokens each. Audio is 32 tokens per second.
How much do 100,000 tokens cost on Gemini 3.8 Flash?
$0.07 as input and $0.38 as output at the current standard rate ($0.75 / $3.75 per 1M tokens, verified 2026-11-17). Google has announced $1.50 / $7.50 per 1M from 2027-01-01, which doubles these costs.
Is my text sent to Google?
No. This page counts in your browser and sends nothing anywhere. Only the official countTokens call shown above sends content to Google.
Other token counters
- All models token counter (every provider, tokenizer methodology)
- Claude token counter
- OpenAI token counter
Tokenizer: gpt-tokenizer 3.4.0 (MIT, license), served from this site.