Free tool · runs in your browser
LLM token counter
Paste text to estimate its token count, see words and characters, and check how much of a model's context window it would use.
An estimate: real counts vary by model (often by 10 to 35%). For exact counts, use the provider's token counting API.
Quick answer
AI models read text as tokens: pieces of words. In English, one token is roughly 4 characters or three quarters of a word; code, numbers and other languages usually use more. Every model family has its own tokenizer, so this tool gives an estimate. For exact numbers, use your provider's token counting API, such as Anthropic's count_tokens endpoint.
How to use it
- Paste your text. A prompt, a document or a conversation.
- Read the estimate. You get estimated tokens, words, characters and lines.
- Check the context window. See what share of a 200K or 1M token context the text would fill.
Example
A short English sentence (about 4 characters per token):
Input
The quick brown fox jumps over the lazy dog.Output
Estimated tokens: 11
Words: 9
Characters: 44
Lines: 1
200K context: 0.01%Common errors and how to fix them
prompt is too long / context_length_exceeded- The prompt, conversation and requested output do not fit the context window. Trim old messages, summarise them, or send only the relevant parts of documents.
The answer stops halfway (stop_reason: max_tokens)- The output limit was reached. Raise max_tokens or ask for a shorter answer.
The bill is much higher than the count- The count covers one message, but the system prompt and the whole conversation are sent with every request. Count all of it.
The estimate differs from the API- Each model has its own tokenizer. Use the provider's token counting endpoint for exact numbers.
Frequently asked questions
How many tokens is a word?
In English, about 1.3 tokens per word on average, or roughly 4 characters per token. Other languages and code use more.
Why do different models give different token counts?
Each model family uses its own tokenizer, which splits text differently. The same text can differ by 10 to 35% between models.
How do I count tokens exactly?
Use the provider's own tokenizer or token counting API; for Claude, the Messages API has a count_tokens endpoint.
What is a context window?
The maximum number of tokens a model can read in one request, including your prompt, the conversation and its answer.
Is my text uploaded?
No. The estimate is calculated in your browser.
Do spaces and punctuation count as tokens?
Yes. They are part of the text the tokenizer splits, and are often attached to the following word.
Why does Chinese or Hebrew text use more tokens?
Tokenizers are trained mostly on English text, so other scripts are split into smaller pieces and use more tokens for the same meaning.
Do images count as tokens?
Yes. Models that read images turn them into tokens too, depending on the image size. This counter estimates text only.
Do output tokens count toward the context window?
Yes. The prompt, the conversation and the model's answer, including any thinking, must all fit in the context window.
How can I reduce the number of tokens in a prompt?
Remove repetition and examples you do not need, send only the relevant parts of documents, and use prompt caching for long text that repeats.
Sources
Related
More tools in this group
- AI tool schema generator
- Word counter
- Character counter
- Sentence counter
- Paragraph counter
- Case converter
Guides and apps
- Building AI agents with LangGraph and n8n: what works in production
- How I built a WhatsApp and Telegram AI support bot with Claude in under 400 lines
- Hire an agentic AI engineer and AI agent developer
- Hire an MCP server developer
- Hire an AI integration engineer
- Custom AI chatbot development with RAG
- Hire an n8n expert and AI automation engineer
- Forward deployed AI engineer for your product
- Hire an agentic AI full stack developer
- Hire me to build AI and backend systems