Free tool · runs in your browser
🔢 LLM Token Counter
Count tokens for GPT-4o and other OpenAI models exactly, see how your text is split, check it against a context window, and estimate the cost of a call with your own prices. Runs in your browser.
Loading the tokenizer (one-time download)…
See how the text is split into tokens
Context window
Cost estimate
Use the current prices from your provider’s pricing page; prices change often, so none are built in.
Runs in your browser: what you enter is never sent anywhere. We only count anonymous usage, such as which buttons are used, to improve the tools.
Why token counts matter
Every model has a context window: the maximum number of tokens it can read and write in one call, counting your instructions, any documents you include, the conversation so far and the answer. Providers also price by token, usually with output tokens costing more than input tokens. Knowing the count lets you fit retrieval chunks into the window, keep prompts lean and forecast costs before you scale.
Ways to use fewer tokens
- Put long, stable instructions in a system prompt and use your provider’s prompt caching where available.
- Retrieve only the relevant passages instead of whole documents, and trim boilerplate such as navigation or legal footers.
- Ask for structured, concise output (JSON with defined fields) instead of open-ended prose.
- Watch for languages and formats that tokenize expensively; minified JSON and long numeric IDs add up fast.
Frequently asked questions
What is a token in an LLM?
A token is a chunk of text the model reads and writes: often a whole common word, part of a longer word, a space plus a word, or a piece of code. Models are priced and limited by tokens, not characters or words.
How many tokens is a word?
For English prose with OpenAI’s current tokenizers, a word averages about 1.3 tokens, or roughly 4 characters per token. Code, numbers and many non-English languages use noticeably more tokens per word.
Are token counts the same for Claude, Gemini and GPT?
No. Each model family has its own tokenizer, so the same text gives different counts. OpenAI publishes its tokenizers, so the counts here are exact for OpenAI models; for others the tool shows an estimated range. Use the vendor’s token-counting API for exact numbers.
Is my text sent anywhere?
No. Tokenizing runs entirely in your browser; the tokenizer data is downloaded once and nothing you type leaves the page.