LLM token counter and cost estimator
Paste a prompt, document or code and see an estimated token count, word and character counts, how much of common context windows it fills, and what a request would cost on popular models. Everything runs in your browser and nothing you paste is sent to our servers.
What is a token?
Language models read text as tokens: chunks that may be a whole word, part of a word, a number or punctuation. In English a token is roughly four characters or three quarters of a word. Source code, JSON, URLs and non-English languages split into more tokens per word.
How accurate is the estimate?
It is a fast approximation using character and word counts, so expect it to be within roughly 10-20% for ordinary English prose and further off for code or other languages. Each provider uses a different tokenizer. If you need exact numbers for billing or limits, use the official token-counting endpoint of your provider.
Estimating API cost
Cost = input tokens ÷ 1,000,000 × input price + output tokens ÷ 1,000,000 × output price. Output tokens usually cost three to six times more than input tokens, so a short prompt with a long answer can cost more than a long prompt with a short answer.
Keeping prompts within the context window
If your text fills most of a model's context window, split the document, summarise earlier parts or use retrieval. Remember the model's reply and any system prompt count against the same window.