LLM Token Counter
Count tokens and estimate API cost for GPT, Claude, Gemini, and more. ChatML overhead, Markdown options, and multi-model compare — all local in your browser.
All processing on this page runs locally in your browser unless noted otherwise.
Token counting runs locally in your browser. Your text never leaves your device. Claude / Gemini / open-weight model counts are approximations only — not billing-accurate.
How to use
- Choose Text, Chat, or Compare mode.
- Optionally skip Mermaid or strip Markdown markers before counting.
- In Chat mode, add System / User / Assistant turns — framing overhead is included.
- Use Compare to pick 2–3 models and contrast tokens & estimated cost.
- Need chunks under a token budget? Split by token limit · multi-file? Batch files
FAQ
Is token counting exact for every model?
OpenAI GPT and o-series models use js-tiktoken for exact local counts. Claude, Gemini, Llama, Mistral, and DeepSeek are local estimates only — not billing-accurate.
What does Chat mode count?
Chat mode adds OpenAI-style message framing overhead (about +3 tokens per message plus assistant priming). For non-OpenAI models this framing is an approximation.
Does my text leave the device?
No. Counting runs in your browser. We do not call vendor token-count APIs. Drafts stay in localStorage on your machine.
How do Markdown options work?
Skip Mermaid drops ```mermaid fences before counting. Strip Markdown removes common markers so you can budget against prose only. Clean Markdown further on mdworkbox if needed.