A free browser-based LLM token counter — paste any text and instantly see token estimates for GPT-4o, Claude 3, Llama 3, and more, along with context window fill percentage and estimated API cost.

Token Counter is a free, browser-based tool that estimates token usage for the most popular large language models — GPT-4o, Claude 3 Opus/Sonnet/Haiku, Llama 3, Gemini 1.5 Pro, and more. Paste any text, pick a model, and instantly see token count, context window fill percentage, and estimated API input cost. No signup, no API key, no server calls.
Every LLM has a context window measured in tokens, and every API call is billed by the token. Two questions come up constantly when building with LLMs:
The answers require counting tokens. But tokens aren't words or characters — they're BPE (Byte Pair Encoding) chunks that vary by model, language, and content type. A sentence that's 22 words might be 28 tokens for GPT-4o and 30 for Llama 3.
Developers end up writing one-off scripts, running Python snippets with tiktoken, or copying text into OpenAI's Playground just to get a number. None of these are fast.
Drop any content into the text area — a prompt, a document excerpt, a system message, a few paragraphs of user input, anything. The counter updates in real time as you type or paste.
Choose from the model selector:
The tool surfaces four numbers instantly:
Below the stats, a context window fill bar shows exactly what percentage of the model's context you're using — with an amber warning when you exceed 80%.
When text is entered, a comparison table shows every supported model side-by-side: token count, context fill percentage, and estimated cost. This makes it easy to decide which model is right for a given input size — or to spot when a document is too large for cheaper/smaller models but fits fine in Claude's 200k window.
The tool uses a BPE approximation calibrated against the cl100k_base tokenizer used by GPT-4 and GPT-3.5. The algorithm:
ceil(len/4))For Claude and Llama models, the same approximation is applied — their tokenizers are similar enough to cl100k_base that the estimate remains in the same accuracy range for English content. Non-English text and code have higher variance; the tool displays a disclaimer noting ±3–5% accuracy.
TokenCounterTool — main client component handling state and computationestimateTokens() — pure function for BPE approximation (no external deps)MODELS — static array of model definitions (context window, pricing)StatCard — reusable stat display componentuseMemo on every text/model changeBefore sending a document to the API, paste a representative sample to verify it fits within the target model's context window. The fill bar makes this visual — if it's at 65%, you have room for a long system prompt. If it's at 95%, you need to truncate or switch to a larger-context model.
Running 10,000 documents through an LLM? Paste one representative document, read the estimated cost, then multiply. The comparison table shows why choosing Claude Haiku over GPT-4o for simple extraction tasks can reduce costs by 10–20x.
LLM APIs return cryptic errors when you exceed the context window — often context_length_exceeded with a token count in the error. Paste your full prompt (system + user + history) into the token counter to diagnose exactly how far over you are.
When building RAG pipelines, you need to know how many tokens a chunk contains to size it correctly. The token counter lets you paste a candidate chunk and verify it's within your target range (e.g., 512 or 1024 tokens).
New to LLMs? The counter makes token pricing tangible. Paste a 500-word article, see it's ~680 tokens, see that processing it with GPT-4o costs $0.0034. The intuition develops fast — "ah, so a full book is about 100k tokens."
The Playground has a token counter, but you need an account, and it only shows OpenAI model counts — no Claude, no Llama, no Gemini. Token Counter is instant and model-agnostic.
tiktoken is accurate but requires a Python environment. Token Counter puts a BPE approximation in the browser — no install, no terminal, no pip.
You can write 10 lines of Python to count tokens. But you'll write it again for the next project, and again for a colleague who doesn't have a Python environment. Token Counter is the utility that lives in your browser history and loads in one click.
Token Counter removes friction from two of the most common LLM development tasks:
Try it now: token-counter.tools.jagodana.com
The client needed a robust developer tools solution that could scale with their growing user base while maintaining a seamless user experience across all devices.
We built a modern application using AI and LLM, focusing on performance, accessibility, and a delightful user experience.
Category
Developer Tools
Technologies
Date
June 2026
More work in Developer Tools