Token Count
Count tokens for GPT-4, GPT-3.5, and GPT-4o — useful for prompt design and cost estimation.
About Token Count
Token Count tells you how many tokens a piece of text uses for GPT-4, GPT-3.5, and GPT-4o — the unit those models bill and budget by. Reach for it when designing a prompt, checking whether content fits a context window, or estimating API cost before you spend. It runs in your browser and returns the token counts as JSON.
- Category
- dev
- Input
- Accepts: text/plain.
- Output
- Outputs: application/json.
- Cost
- Free, runs in your browser
- Memory
- low
Common uses
- Estimate the API cost of a prompt before sending it to an OpenAI model
- Check that a long document fits inside a model's context window
- Trim a system prompt down to a token budget without guessing
- Compare how the same text tokenizes across GPT-4, GPT-3.5, and GPT-4o
- Size a batch of inputs to plan throughput and spend
- Verify that a few-shot example set isn't eating your whole context window
Frequently asked questions
Which models does it support?
GPT-4, GPT-3.5, and GPT-4o, since their tokenization is what most prompt design and cost estimation target.
Why count tokens instead of words?
LLMs charge and limit by tokens, not words, and a token is often a word fragment. Token counts are what actually map to cost and context limits.
Does my prompt get sent to OpenAI or any server?
No. The tokenizer runs in your browser, so the text you measure stays on your device and nothing is sent to OpenAI.
What does it return?
JSON with the token count, useful for plugging into your own cost or capacity calculations.
Will the count be exact for billing?
It uses the models' tokenization, so counts match closely. Real API billing also includes output tokens, which depend on the response length.
What input does it take?
Plain text. Paste a prompt or document to measure it.
Keywords
- tokens
- gpt
- openai
- tokenize
- prompt
- cost
- count
- llm