Token Counter
Exact OpenAI tiktoken counts (o200k & cl100k) plus Claude, Gemini, and DeepSeek estimates. Free, private, browser-local.
Privacy: Text never leaves your browser. OpenAI counts use a local tiktoken port — no API key.
| Tokenizer | Tokens | Accuracy | Notes |
|---|
How to Use
- 1Paste the prompt or document you plan to send to a model.
- 2Use o200k for modern OpenAI models; cl100k for GPT-4 / 3.5.
- 3Treat Claude / Gemini / DeepSeek rows as planning estimates.
- 4Jump to the LLM Cost Calculator to turn tokens into monthly $.
Why counts differ
Code & URLs
Often more tokens than plain prosePunctuation and paths split into many BPE pieces.
CJK / emoji
Higher tokens per visible characterCharacter heuristics undercount; tiktoken stays exact for OpenAI.
Tips
- •System + tools + history all count toward the context window — not just the user message.
- •For Claude billing-critical work, confirm with Anthropic’s count_tokens API.
- •Shorter prompts usually beat “clever” compression that models ignore.
- •Pair this with the cost calculator when comparing model tiers.
Frequently Asked Questions
How accurate is this token counter?
OpenAI rows use gpt-tokenizer (a pure-JS port of tiktoken) with o200k_base and cl100k_base — those counts match OpenAI’s tokenizer. Claude, Gemini, and DeepSeek rows are labeled estimates because those vendors don’t publish a browser tokenizer.
What is o200k_base vs cl100k_base?
o200k_base is used by GPT-4o, GPT-5.x, and o-series models. cl100k_base is used by GPT-4 and GPT-3.5. The same English text can produce slightly different counts under each encoding.
Does my text leave the browser?
No. Tokenization runs entirely client-side. Nothing is uploaded.
Can I use this for billing?
Use exact OpenAI counts for OpenAI prompts. For Anthropic/Google, verify with their official count APIs before locking budgets. Pair with our LLM Cost Calculator for dollar estimates.
Why show a token preview?
Seeing how text splits into pieces helps debug weird counts (URLs, code, CJK, emoji) and teaches how BPE tokenizers work.
Is the token counter free?
Yes. No signup and no API key required.
Related Tools
LLM Cost Calculator
Turn token counts into multi-provider $ estimates
Prompt & Rules Linter
Score system prompts and agent rules
JSON to Schema
Infer Zod for structured LLM outputs
MCP Tool Checker
Score agent tool schemas for readiness
Cursor Rules Generator
Generate AGENTS.md and .mdc rules
Token Counter
Exact OpenAI tiktoken plus Claude/Gemini estimates