AI Token Counter
Count GPT-4o and GPT-4 tokens in your text with real tiktoken encodings, plus words, characters and an API cost estimator.
What you enter in this tool and its results may be saved and used to improve AI Walay tools. Please don't enter passwords or private personal details.
About the AI Token Counter
Count exactly how many tokens your text uses, with the same tiktoken encodings OpenAI's models use: o200k_base for GPT-4o and newer, and cl100k_base for GPT-4, GPT-3.5 and the embedding models. Counts update live as you type, alongside word and character totals.
Token counts drive everything in LLM work — context-window limits, truncation bugs and, above all, API cost. The built-in cost estimator multiplies your token count by per-million-token prices: pick a model preset or type your own current rates, since providers change pricing frequently. Claude and Gemini use different private tokenizers, so treat these counts as a close estimate (roughly ±15%) for them.
Your prompts — the tokenizer itself is downloaded once and runs locally.
How to Use the AI Token Counter
- 1Paste your prompt or text into the box — the tokenizer loads automatically on first input.
- 2Read the live counts: o200k tokens (GPT-4o and newer), cl100k tokens (GPT-3.5/4), words and characters.
- 3For cost, pick a model preset or enter your own $ per 1M token prices.
- 4Check the estimated cost of sending this text as input.
Frequently Asked Questions
What is a token, and why is it not the same as a word?
Language models split text into tokens — chunks that can be whole words, word pieces or punctuation. In English, one token averages about four characters, so 1,000 tokens is roughly 750 words. Code, non-English languages and unusual formatting use more tokens per word, which is why an exact tokenizer beats rules of thumb.
Which encoding should I look at, o200k or cl100k?
Use o200k_base for GPT-4o and everything OpenAI has released since. Use cl100k_base for GPT-4, GPT-3.5-turbo and the text-embedding-3 models. The two often differ by several percent on the same text because o200k has a larger vocabulary — this tool shows both so you can match your actual model.
Does this counter work for Claude and Gemini?
As an estimate, yes. Anthropic and Google use their own tokenizers that are not publicly available, so no browser tool can give exact counts for them. In practice the tiktoken numbers land within about 15% of Claude and Gemini counts for typical English text — close enough for budgeting and context-window planning.
How is the API cost calculated?
Cost equals tokens divided by one million, multiplied by the model's price per million input tokens. This tool uses your o200k token count with the preset or custom price you enter. Remember the response costs extra at the (usually higher) output rate, and always verify current prices on your provider's pricing page.
Cite this tool
Using this tool in a paper, report or project? Copy a ready-made citation.
AI Walay. (2026). AI Token Counter [Online tool]. AIWalay Tools. https://aiwalay.pk/tools/dev-tools/token-counter/