LLM Token Counter & Cost Estimator

Before you send a prompt to an API, you usually want to know two things: how many tokens it is, and what it will cost. This tool counts tokens for GPT, Claude, Grok, and Gemini models and estimates the API price as you type. OpenAI counts are exact — it runs the real tiktoken BPE tokenizer in your browser, the same <code>o200k_base</code> encoding GPT-5 and Codex use — while Claude, Grok, and Gemini counts are clearly-labeled estimates, because those providers publish no client-side tokenizer. Nothing is uploaded; your prompt never leaves the page.

0
Tokens
0
Characters
0
Words
Chars / token

How to Use This Tool

  1. Choose a model from the dropdown. OpenAI models use the exact tokenizer; Claude models show a labeled estimate.
  2. Paste your text or prompt into the box. The token count, character count, and word count update live as you type.
  3. Read the cost estimate — below the counts, the tool shows the approximate API cost for this text as input, plus the per-1M-token rate for the selected model.
  4. Switch models to compare — change the model to see how token count and cost differ across GPT and Claude tiers for the same text.

Counting Tokens for GPT and Claude

Large language models do not read characters or words — they read tokens, the sub-word units produced by a byte-pair-encoding (BPE) tokenizer. Every API charges by the token, and every model has a context-window limit measured in tokens, so knowing the token count of a prompt is the first step in both budgeting and staying within limits. A rough rule of thumb for English is about four characters per token, or three-quarters of a word, but the only way to get an exact number is to run the model's actual tokenizer.

OpenAI open-sourced its tokenizer (tiktoken), so an exact GPT token count can be computed anywhere, including in the browser. GPT-4o, GPT-4o mini, and GPT-4.1 use the newer o200k_base encoding; GPT-4, GPT-4 Turbo, and GPT-3.5 use cl100k_base. This tool loads the correct encoding for the model you pick and counts byte-for-byte the same way the API will.

Anthropic, by contrast, does not publish Claude's tokenizer. The only exact Claude token count comes from the count_tokens API endpoint, which needs an API key and a network round-trip. For sizing a prompt in the browser, a character-based estimate is the best available approximation — and this tool labels it clearly as an estimate rather than pretending otherwise. If you see another site reporting an exact Claude count client-side, it is almost certainly running OpenAI's tokenizer against Claude, which produces the wrong number.

Frequently Asked Questions

How are the token counts calculated?
For OpenAI models the count is exact: the tool runs the real tiktoken byte-pair encoding (the o200k_base encoding for GPT-5, Codex, GPT-4o and GPT-4.1, and cl100k_base for GPT-4, GPT-4 Turbo and GPT-3.5) entirely in your browser via the open-source gpt-tokenizer library. For Claude, Grok and Gemini the count is an estimate (about 3.6 characters per token for Claude, about 4 for Grok and Gemini), because none of those providers publishes a client-side tokenizer — see the next question.
Why is the Claude token count only an estimate?
Anthropic does not release Claude's tokenizer publicly, so there is no way to compute an exact Claude token count in the browser. The only exact source is Anthropic's own /v1/messages/count_tokens API endpoint, which requires an API key. This tool gives a character-based approximation (about 3.6 characters per token for typical English) so you can size a prompt; for billing-critical numbers, call the count_tokens API. Beware of any tool that claims an exact Claude count client-side — it is almost certainly using OpenAI's tokenizer, which is wrong for Claude.
What is a token?
A token is the unit an LLM actually reads — usually a short run of characters rather than a whole word. Common English words are often one token, but longer or rarer words split into several, and whitespace and punctuation count too. A useful rule of thumb is about 0.75 words per token, or roughly 4 characters per token, for English prose. Code, non-English text, and unusual formatting tokenize less efficiently. See the what is a token guide for the full explanation.
How accurate is the cost estimate?
The token count drives the cost, and the per-model prices are taken from each provider's public pricing (verified as of the date shown under the result). Providers change prices periodically, so treat the figure as an estimate and confirm against the official OpenAI and Anthropic pricing pages before relying on it for budgeting. The estimate also assumes your text is the input; real API cost includes the model's output tokens, which you cannot know until the response is generated.
Is my text sent anywhere?
No. The tokenizer runs entirely in your browser — your text is never uploaded to Janeer or any third party. That is the main reason to use a dedicated tool rather than pasting a sensitive prompt into a chatbot to ask how many tokens it is: you keep proprietary prompts, customer data, and unreleased content on your own machine.