Token Counter & LLM Cost Calculator
Count tokens exactly with OpenAI’s tokenizer, plan a context-window budget, compare API costs across Claude, OpenAI and Gemini, preview RAG chunks and price images. Everything runs in your browser.
| Model | Input $/M | Cached $/M | Output $/M | Per request | Per day | Per month |
|---|
How to use the Token Counter
- Paste your prompt or document and pick a tokenizer.
- See the exact OpenAI token count (or a Claude/Gemini estimate).
- Use Context Budget to check it fits the model, and Cost to compare providers.
- Use Chunking to preview RAG chunks, and Image Tokens for vision inputs.
Why use this Token Counter
- Exact tiktoken counts (o200k_base, cl100k_base)
- Context-window planner for Claude, GPT and Gemini
- API cost comparison with caching and Batch discounts
- RAG chunk visualizer and image token calculator
Related tools
Frequently Asked Questions
Is this token counter exact?
For OpenAI models it is: picking o200k_base or cl100k_base runs the real tiktoken vocabulary (via js-tiktoken) in your browser. Anthropic and Google do not publish their tokenizers, so Claude and Gemini counts are clearly labelled estimates.
Is my text uploaded anywhere?
No. Tokenizing, chunking and cost maths all run locally. The tokenizer files are served from this site and cached by your browser.
Which models use o200k_base?
OpenAI's GPT-4o, GPT-4.1, the o-series and the GPT-5 family use o200k_base. GPT-4 and GPT-3.5 Turbo use cl100k_base.
How is the API cost calculated?
Cost = uncached input × input price + cached input × cache-read price + output × output price, per request, multiplied by your daily volume. Batch halves both input and output. Cache-write surcharges and long-context tiers are not included.
How do I choose a chunk size and overlap for RAG?
Start with 500–1,000 tokens and 10–20% overlap, then check the Chunking tab to see whether chunks break mid-sentence or split related sections. Recursive or Markdown-aware splitting usually keeps ideas together better than fixed windows.
How many tokens does an image cost?
Claude counts one token per 28×28-pixel patch after downscaling to the model's limit (2576 px / 4784 tokens on Claude 4.7 and later, 1568 px / 1568 tokens on older models). OpenAI tile models charge a base amount plus a fee per 512 px tile. The Image Tokens tab applies these rules.
What is a token?
A token is a chunk of text a language model processes: often a whole word, part of a word or a punctuation mark. Models are priced and limited by token count, not characters.