Skip to content
llmkitty calico cat logo llmkitty

Token Counter

Free online token counter for GPT, Claude, Gemini, Llama, Mistral, DeepSeek, and Grok. Exact BPE counts for OpenAI models (same encodings as tiktoken); clearly labeled estimates everywhere else. See characters, words, and how much of the context window you’re using, 100% client-side.

Tokenizer

Sample text — start typing to replace

Tokens

0

Characters

0

Words

0

Tokens / word

0

0 of 0 · 0%

Context window last verified: 2026-07-12

Runs entirely in your browser, your text never leaves your device.

See what this costs to run →
llmkitty sleeping cat, curled up next to the token count

What a token actually is

A token is the unit a language model reads, generates, and gets billed in. It sits somewhere between a character and a word. Language models don't process raw text one letter at a time or one word at a time; they run a tokenizer first, which breaks your text into a sequence of sub-word pieces drawn from a fixed vocabulary the model was trained on. Common English words like "the" or "and" are usually a single token. Longer, rarer, or made-up words often split into two or three token pieces. Punctuation, whitespace, and non-English scripts tokenize differently again, a block of code or a sentence in a language the tokenizer wasn't heavily trained on can use noticeably more tokens per character than plain English prose. As a rough working rule, one token is about 4 characters, or roughly ¾ of a word, for typical English text, but that's an average, not a guarantee for any specific sentence.

Why the same text counts differently on different models

Every model family trains its own tokenizer on its own vocabulary, so the same paragraph produces a different token count depending on which model reads it. OpenAI's newer models (the GPT-4o/4.1/5-era and the o-series) share one encoding, called o200k_base; OpenAI's older GPT-4, GPT-3.5, and embedding models use an earlier encoding, cl100k_base. Switch the model selector above between, say, GPT-5.5 and GPT-4, and you'll usually see the token count shift slightly on identical text. That's not a bug; it's two different vocabularies making different splitting decisions. Other providers' models will count differently again, for the same underlying reason, even before you get into the exact-versus-estimate distinction below.

Exact counts vs. estimates, and why we label them

This tool runs two genuinely different methods depending on the model you pick, and it's honest about which one you're getting. For OpenAI models, it uses gpt-tokenizer, a pure-JavaScript implementation of the same byte-pair encodings (o200k_base and cl100k_base) that OpenAI's own tiktoken library uses. That's an exact count, marked with a green "exact" badge, computed entirely in your browser with no network call. For every other provider (Claude, Gemini, Llama, Mistral, DeepSeek, and Grok) there's no equivalent public, client-side tokenizer to bundle for free. Anthropic deprecated the local tokenizer it used to publish. Google's Gemini tokenizer is SentencePiece-based and only exact via a network API call, which this tool deliberately avoids because it would mean sending your text to a server. So those models fall back to a character-based heuristic, and the badge switches to an honest orange "estimate," with a tooltip explaining exactly why, right where you'd otherwise assume precision you're not actually getting.

That heuristic isn't one flat number applied blindly across every provider, either. Most estimate-lane models split at roughly 4 characters per token, and that's the default here. But Anthropic's newer tokenizer (Opus 4.7 and later, Fable 5, Sonnet 5) is measurably denser: it produces about 30% more tokens for identical text than the older one, so this tool estimates those three Claude models at roughly 3.1 characters per token instead of 4, rather than quietly underselling how many tokens your prompt actually costs. Claude Haiku 4.5 isn't confirmed to use the newer tokenizer, so it stays on the standard 4-char default until that's verified either way. Competitors that quietly present a heuristic as if it were exact, or apply one ratio to every non-OpenAI model regardless of vendor, are giving you a false sense of precision; we'd rather show you a number that says "estimate" and get the estimate itself right, per model, than round every provider down to the same guess.

Reading the context-window meter

Underneath the token count, a meter shows what percentage of your selected model's context window your text would use. A model's context window is the maximum number of tokens it can hold in a single conversation or request, prompt plus any expected response. Watching this meter matters most once you're pasting something substantial: a long document, a big codebase file, or an entire chat history you're re-sending. If the meter passes 100%, the text as written won't fit in that model's window at all, and you'll need to trim it, chunk it, or switch to a model with more headroom.

Cutting your token count

The fastest wins are usually mechanical: strip repeated boilerplate and redundant instructions from a system prompt, remove unused few-shot examples, and avoid pasting the same large block of context into every message when your integration could reuse it instead. Beyond that, tokenization itself rewards plain, common-word English over dense jargon, unusual formatting, or heavily nested code, the same idea expressed simply will often tokenize shorter than the same idea expressed densely. Once you know your token count, the natural next question is what it costs to actually run: the AI token cost calculator takes the exact numbers from this page (use the "See what this costs to run" link above to hand them over automatically) and turns them into a per-call and per-month dollar estimate across every provider.

Frequently asked questions

What is a token?

A token is the unit language models actually read and bill in, not quite a word, not quite a character. Common English words are often a single token, longer or rarer words split into a few token pieces, and punctuation and whitespace usually get their own tokens. As a rough rule of thumb, one token is about 4 characters or roughly ¾ of a word.

Is this the same as tiktoken?

For OpenAI models, yes, the exact lane here runs on the gpt-tokenizer library, which implements the same o200k_base and cl100k_base byte-pair encodings OpenAI's own tiktoken library uses. You should get identical counts to tiktoken for GPT-4o/4.1/5-era, o-series, classic GPT-4, GPT-3.5, and the text-embedding-3 models. For every other provider, see the next question. Those are estimates, not tiktoken-equivalent counts.

Why is the Claude count an estimate?

Anthropic doesn't currently publish a client-side tokenizer library the way OpenAI does; it deprecated the local tokenizer it used to ship. The only way to get an exact Claude count today is a network call to Anthropic's API, which would mean sending your text to a server and breaking the zero-cost, nothing-leaves-your-device design of this tool. So Claude (like Gemini, Llama, Mistral, DeepSeek, and Grok) uses a character-based estimate instead, clearly marked with an orange "estimate" badge rather than presented as exact.

Does my text get sent anywhere?

No. Every count on this page, exact or estimate, runs in JavaScript in your own browser. Nothing you paste is uploaded, logged, or sent to a server, for any model, in either lane.

Why do different models count the same text differently?

Each model family uses its own tokenizer, trained on its own vocabulary, so the same sentence splits into a different number of pieces depending on which model reads it. Switching the model selector above re-counts your exact same text under that model's tokenizer (or heuristic, for the estimate lane), the token count is a property of the model, not just the text.

How many tokens is a word, or how many words is a token?

For typical English, one token is roughly ¾ of a word, or equivalently one word is roughly 1.3 tokens, though this varies by model and by how common the words are. Use the "I have a token count" mode above to flip the calculation and get an estimated word count from a token number instead.

Related tools

AI Token Cost CalculatorOpenAI API Pricing CalculatorClaude API Pricing CalculatorGemini API Pricing CalculatorLlama API Pricing Calculator