AI Token Counter
Count tokens for GPT, Claude, and Gemini prompts at once. The GPT count is exact — computed with OpenAI's real tokenizer, right in your browser. Claude and Gemini have no public client-side tokenizer, so those two are clearly-labeled estimates, not exact counts.
Last verified
0
tokens · OpenAI tiktoken (cl100k_base)
0
tokens · ~3.5 characters per token
0
tokens · ~4 characters per token
How this works
The GPT count uses tiktoken, OpenAI's own byte-pair-encoding tokenizer, via the pure-JavaScript js-tiktoken port — the same algorithm OpenAI's API itself uses, running locally in your browser rather than on a server. That's what "Exact" means on that card.
Claude and Gemini don't have an equivalent public tokenizer you can run client-side — getting a byte-for-byte accurate count for either one means calling Anthropic's or Google's own API with your text, which this tool deliberately doesn't do. Instead, those two cards show a character-based estimate: text length divided by roughly 3.5 for Claude and roughly 4 for Gemini. It's a genuinely useful approximation, not a precise count — treat it as a ballpark, not a number to bill against.
Model & encoding comparison
| Model family | Provider | Tokenizer / method | Count type |
|---|---|---|---|
| GPT-3.5, GPT-4, GPT-4 Turbo | OpenAI | cl100k_base (tiktoken) | Exact |
| GPT-4o and newer | OpenAI | o200k_base (tiktoken) | Not yet supported here |
| Claude 3, Claude 4 family | Anthropic | Character estimate (~3.5 chars/token) | Estimated |
| Gemini 1.5, Gemini 2.x family | Character estimate (~4 chars/token) | Estimated |
This table is tied to the "Last verified" date above, not a manually-remembered timestamp — check that date to see how current it is.
Frequently asked
Is the GPT token count exact?
For GPT-3.5 and GPT-4 (cl100k_base encoding), yes — it uses OpenAI's own tiktoken algorithm, the same tokenizer OpenAI's API uses to bill and enforce context limits for those models, running entirely in your browser. Newer GPT-4o-and-later models use a different encoding (o200k_base) that this tool doesn't count against yet — see the comparison table below.
Why are the Claude and Gemini counts estimates, not exact?
Neither Anthropic nor Google publishes a client-side tokenizer — getting an exact count for those models requires calling their own server-side API. This tool stays fully client-side (your text never leaves your browser), so Claude and Gemini counts use a character-based estimate instead: about 3.5 characters per token for Claude (Anthropic's own published guidance) and about 4 for Gemini (a widely-used general estimate). Real counts can differ by roughly 10-20%.
Does my text get sent anywhere?
No. All counting happens locally in your browser. Nothing you type or paste is uploaded, logged, or stored anywhere.
What's a token, exactly?
A token is the unit AI models actually process — usually a word, part of a word, or a punctuation mark, not exactly one character and not exactly one whole word. API pricing and context-window limits are measured in tokens, not characters or words, which is why a tool like this one is useful before you send a prompt.
Why does the same text produce different token counts for different models?
Each model family uses its own tokenizer, trained on its own vocabulary. GPT's, Claude's, and Gemini's tokenizers all split the same sentence differently, so token counts — and therefore cost and context usage — aren't directly comparable across providers without checking each one separately.
Emitted as FAQPage JSON-LD from the same frontmatter — one source, no duplicated prose.