Free tool
AI Token Counter
Count estimated tokens, words and characters — and see how much of an AI context window your text uses.
Runs entirely in your browser.
Your text is processed entirely in your browser and isn't sent to HistChat.
Text statistics
Estimated tokens
0
Tokenization differs between AI models, so this is an estimate. How accurate is it?
- Words
- 0
- Characters
- 0
- Characters, no spaces
- 0
- Lines
- 0
Context window
Context usage
Default context window
128,000 token context
Choose a model above to use its documented limit.
- used
- 0
- remaining
- 128,000
- of context used
- 0%
Your textResponse reserve
Space kept free for the model's reply.
Remaining input budget124,000
Token counts are estimated. Choosing a model sets its documented model/API context window; it does not switch tokenizers.
Limits inside consumer apps can differ.
More utilities for working with AI assistants: all free tools.
Guide
What is a token in AI?
A token is the unit a language model reads and writes. It is usually a piece of text: a common word may be one token, a longer or rarer word may be split into several, and numbers, punctuation, spaces and line breaks all take tokens too. Prompt limits, response limits and many usage bills are measured in tokens, not words.
How AI token counting works
Before a model sees your text, a tokenizer breaks it into tokens from a fixed vocabulary. Most modern tokenizers learn that vocabulary from training data, so frequent strings like “ the” become single tokens and unusual strings are cut into smaller pieces. An exact count therefore needs the specific tokenizer a model uses.
This tool does not run a tokenizer. It weights each character by type: letters, digits, spaces, line breaks, punctuation, CJK characters, other scripts and emoji each add a different fraction of a token, and the total is rounded. That keeps the page small and fast, and it works on very large pastes without a delay.
Why token counts differ between models
Each model family has its own tokenizer with its own vocabulary, and a provider may change it between model generations. The same paragraph can be a different number of tokens in two models, and the gap is usually larger for code, numbers and languages other than English. Counts shown inside a chat product or returned by an API can also include system instructions, earlier messages, tool definitions and attachments that are not in the text you paste here.
Tokens vs words vs characters
There is no fixed conversion, only rough ratios. These are approximate figures for OpenAI-style tokenizers, from the comparison used to tune this tool:
| Kind of text | Characters per token |
|---|---|
| English prose | about 4 to 5 |
| Source code | about 3 to 4 |
| JSON and other data | about 3 |
| Numbers, IDs and dates | about 2 |
| Chinese and Japanese | about 1 to 1.5 |
What is a context window?
The context window is the total number of tokens a model can work with in one request. It has to hold your prompt, the conversation so far, any pasted documents or attachments, and the reply the model generates. If a request does not fit, the provider may reject it, cut older content, or limit the length of the answer. Some models also cap the length of a single reply separately from the window.
Different models have different context windows, because the window depends on how each model was built and served. The calculator's model presets use the context window each provider documents for its API. Choosing a model only sets that size; the token count stays an estimate and does not switch to that model's tokenizer.
Limits inside consumer apps such as ChatGPT, Claude or Gemini can differ from the API figures, and providers change both over time. Check your provider's documentation for the model and plan you use. For your own size, open More models and choose Other model / custom context.
How to estimate whether a prompt will fit
- Paste your prompt, conversation or document into the box above.
- Pick your model to use its documented context window, or open More models and choose Other model / custom context.
- Set a response reserve for the answer you expect. A short answer needs a few hundred tokens; a long one needs thousands.
- Read the remaining input budget. If it is close to zero, shorten the input or choose a larger window, and leave a margin because the count is an estimate.
Prompt token counter: what you can paste
Use it as a prompt token counter for anything you plan to send to a model: a prompt, a system prompt, a long document, a block of code or a whole chat transcript. Paste several parts together to size a full request, for example the system prompt, the conversation so far and the document you want summarised. The count covers only the text in the box, so remember that a real request can also carry tool definitions and attachments.
Response reserve and remaining input budget
Because the reply shares the window with your input, the calculator works as a context window calculator rather than a plain counter. The model's window is the total. The response reserve is the part you keep free for the answer, 4,000 tokens by default and yours to change. The remaining input budget is what is left for your own text after the reserve and what you have already pasted. Some providers also list a separate maximum output length, so check the model page if you expect a very long reply.
ChatGPT token counter
Paste text you plan to give ChatGPT or an OpenAI model to see roughly how many tokens it is. Choose GPT-6 Astra, GPT-6.1 Sol and GPT-6 Luna and the calculator uses the 1,050,000-token context window OpenAI documents for that model in its API. The count itself is still an estimate: the tool does not run OpenAI's tokenizer, and picking a model never changes the number. The ChatGPT app is a product with its own limits, which can differ from the API model limits and depend on your plan, so treat the preset as API planning rather than a promise about your chat. For an exact figure, use the usage numbers the API reports.
Claude token counter
The presets include Claude Opus 5.5, Claude Sonnet 5.5 and Claude Haiku 5.5, each set to the 1,000,000-token context window Anthropic documents for its API. Selecting one only changes the window used for planning. Claude has its own tokenizer, so the estimate here can be higher or lower than Claude's own count, and it stays approximate. Limits in the Claude app can also differ from the API, depending on your plan and features such as attachments or tools, so check what applies to you. When you are close to a limit, rely on the token usage Claude reports.
Gemini token counter
Gemini is covered the same way: Gemini 4 Argon, Gemini 3.8 Flash and Gemini 3.5 Flash-Lite are available as presets, each using the 1,048,576-token window Google documents for the Gemini API. The token count is an estimate, not Gemini's own tokenizer, and choosing a model does not switch to it. Limits in the Gemini app can differ from the API, and the model page explains how input and output share the window, which is why the response reserve is worth keeping. Use Google's own counts when you need an exact figure.
How many words are in 1,000 tokens?
For plain English text, about 750 words is a common rule of thumb, which also means a token is often a little under one word. Treat it as a guide, not a rule: dense technical writing, code, URLs and other languages use more tokens per word, so the same 1,000 tokens holds fewer.
How accurate is this estimate?
We compared the estimate with OpenAI's o200k_base and cl100k_base tokenizers on prose, Markdown, code, JSON, URLs, numbers, emoji and several languages. On English prose, Markdown and code it was usually within about 10% of the real count, and the average difference across the whole test set was about 10% against o200k_base. It tends to undercount JSON and indentation-heavy code such as Python by roughly 20 to 25%, and it is less reliable for languages with other scripts, where tokenizers differ most.
Claude and Gemini use their own tokenizers, so their counts can differ in ways we have not measured. When you are close to a hard limit, use your provider's own token counter or the usage figures it reports.
Frequently asked questions
- What is an AI token?
- A token is a chunk of text that a language model reads and writes: a whole word, part of a word, a number, a punctuation mark or a space. Models count their input, output and context window in tokens rather than in words or characters.
- How many words is 1,000 tokens?
- For ordinary English prose, roughly 750 words, though it varies with the text and the tokenizer. Code, numbers, URLs and many non-English languages use more tokens per word, so the same 1,000 tokens covers fewer words.
- Is this token count exact?
- No. It is an estimate. Different AI models use different tokenizers, and this tool does not run any model's own tokenizer. On English prose it was typically within about 10% of OpenAI's tokenizers in our comparison, and it is less precise for code, JSON and other languages.
- Why is the count different from Claude's own count?
- Claude uses its own tokenizer, which splits text differently from other models, so the same text produces a different number. Counts reported for a conversation can also include things that are not in your pasted text, such as system instructions, earlier messages and attachments.
- Why is the count different from OpenAI's tokenizer?
- OpenAI's tokenizers are real byte-pair encodings with fixed vocabularies, and different model generations use different ones. This tool estimates from character types instead of running an encoding, so it can be higher or lower than the exact figure for a specific model.
- What is a context window?
- The context window is the most text, measured in tokens, that a model can consider in a single request. It has to hold your prompt, the earlier conversation, anything you attach, and the reply the model writes.
- Does selecting a model make the token count exact?
- No. Selecting a model sets its documented context-window size; the token count remains an estimate, because this tool does not run that model's tokenizer.
- Why can the limit differ in ChatGPT or Claude?
- The model presets use the context windows providers document for their APIs. Consumer apps can apply different limits, so check the app or plan you actually use.
- Is my text uploaded anywhere?
- No. The counting happens in your browser. What you paste is not sent to HistChat, not stored, not placed in the page address, and not included in analytics. It disappears when you close or reload the page.
Working with MCP servers? Try the MCP Config Generator.