Estimate prompt tokens before you spend a call
Tokens drive both your cost and whether a prompt fits the model’s context window. This counter gives you a fast, per-model token estimate for GPT-4o, Claude and Gemini as you type, plus a rough input-cost figure and how much of a typical context window the prompt uses — so you can trim before you send rather than after a 400 or a surprise bill.
How it works
Counting exact tokens requires each provider’s byte-pair tokenizer, which is too heavy to ship into a browser page. Instead this tool uses a calibrated heuristic: it measures character count, word count and whitespace, then applies a per-model density factor reflecting how each tokenizer tends to split English text (around four characters per token, with adjustments). The result is a close estimate for ordinary prose. It then multiplies by published input prices to show an approximate cost and compares against a representative context-window size for each family.
Tips and notes
Use this for budgeting and context-fit checks, not for exact billing — the real
number comes from the provider’s own tokenizer (tiktoken for OpenAI, the
Anthropic token-count endpoint, Gemini’s count-tokens API). Estimates are least
accurate on source code, JSON, non-English scripts and text with unusual
punctuation, where token density diverges from prose. If a prompt sits right at
a context limit, leave headroom for the model’s response, which also consumes
tokens from the same budget. Everything runs locally, so pasting sensitive
prompt text is safe.