AI Token Counter
Estimate how many LLM tokens your text uses, plus characters, words, and cost.
About the AI Token Counter
The AI Token Counter gives you a fast, local estimate of how many tokens a piece of text will use when you send it to a large language model (LLM) such as GPT, Claude, or Gemini — alongside the plain character and word counts. Models don't read text word by word; they break it into "tokens," the small chunks of characters that models charge for and count against their context limits. This tool approximates that token count instantly as you type, and can estimate your cost if you enter a price per 1,000 tokens. Everything runs in your browser, so nothing you paste is ever uploaded or sent to any tokenizer service.
Knowing your token count matters because both pricing and context windows are measured in tokens, not words. A prompt that looks short can still be token-heavy if it's full of code or punctuation. Use this estimate to sanity-check a prompt, budget a batch job, or see roughly how much of a model's context window a document will fill.
How to use
- Type or paste your text into the box. The character, word, and estimated-token counts update on every keystroke.
- Read the token estimate. The large "~tokens" number is the central estimate; the line beneath it shows a low-to-high range so you can see the uncertainty.
- Enter a price (optional). Put your model's cost per 1,000 tokens in the "Cost per 1K tokens" field to see an estimated dollar cost for the current text.
- Copy or clear when you're finished — "Copy text" returns the text to your clipboard, and "Clear" empties the box.
How the estimate works
This tool does not run a real tokenizer, and it does not call any API. It uses a transparent, well-known heuristic that works entirely in JavaScript on your device. For English prose, one token averages roughly four characters, or about three-quarters of a word. The central estimate is computed as max(characters ÷ 4, words × 1.33), taking the larger of the two so that very short or punctuation-dense text isn't undercounted. The displayed range runs from characters ÷ 4 on the low end to words × 1.5 on the high end, which brackets most real-world results.
Because this is an approximation, it will not match a model's exact count. Real tokenizers use Byte Pair Encoding (BPE) or similar schemes, and every model family — OpenAI's tiktoken, Anthropic's tokenizer, Google's, and others — splits text slightly differently. Whitespace, numbers, emoji, non-Latin scripts, and source code all tokenize in ways a simple character ratio can't perfectly predict. Treat the result as a close ballpark (typically within about 10–20% of the true count for ordinary English), not an exact figure. When precision matters — for example, when you're right at a context-window limit — verify with the official tokenizer for your model.
Frequently asked questions
Is this the same as GPT's or Claude's real token count?
No. It's a heuristic estimate, not the output of an actual tokenizer. Real models use BPE-based tokenizers that split text in model-specific ways. This tool's character-and-word ratio lands close for typical English but can drift for code, other languages, or heavy punctuation. Use the official tokenizer when you need an exact number.
Why show a range instead of one number?
Because no single ratio is right for every input. The range (from characters ÷ 4 up to words × 1.5) reflects real uncertainty: dense text lands near the high end, while long, plain words land near the low end. The central "~tokens" figure is your best single guess.
How is the estimated cost calculated?
It multiplies your estimated tokens by the price you enter per 1,000 tokens: cost = (tokens ÷ 1000) × price. It uses the central token estimate, so the cost is only as accurate as that estimate. Many providers price input and output tokens differently — enter whichever rate applies to the text you're measuring.
Does my text get uploaded anywhere?
Never. All counting and math happen locally in your browser with plain JavaScript. Nothing is sent to a server, no tokenizer API is called, and nothing is stored. Close the tab and the text is gone.
Why don't tokens equal words?
Models split text into sub-word pieces. Common words are often a single token, but longer or rarer words, numbers, and symbols split into several. Spaces and punctuation can also become their own tokens, which is why token counts usually run a bit higher than word counts.
Does it work for other languages or code?
It runs on any text, but the estimate is tuned for English prose. Non-Latin scripts and source code tokenize very differently and may fall outside the shown range. For anything critical, confirm with your model's official tokenizer.