Free tool · no signup · runs in your browser

AI Token Counter for Chatbot Prompts

Count tokens the way a chatbot sends them: system prompt, knowledge and conversation, each on its own and all together. Check the context window, see the text split into tokens, and price the request. Your text never leaves the browser.

Paste your prompt

Loading the tokenizer
Counts are estimates for a moment, then switch to the real tokenizer.
0 tokens

Your instructions to the model. Sent with every request.

0 tokens

Passages retrieved from your documents for this question.

0 tokens

The messages so far, including the new one.

Only have one piece of text? Paste it into any box. The total is the same.

Check it against a model

The model's limit for prompt and reply together.

List prices read from each vendor's page on 2026-12-03. The reply size above is priced as output.

For a whole month of conversations, with history growing every turn, use the LLM cost calculator.

See the tokens

Show tokens for
The token view needs the tokenizer, which is still loading.

Each coloured block is one token. Notice that a space usually belongs to the word after it, and that long or unusual words break into several pieces.

Counting happens on your device. Nothing you paste is uploaded or stored, so it is safe for internal prompts.

How this counter counts

The count comes from o200k_base, a tokenizer vocabulary OpenAI publishes, run in your browser with the open-source js-tiktoken library. For text that a model encodes with that vocabulary it is the same splitting the model does, not a guess based on length.

Other vendors use their own vocabularies and do not publish one that can run on a web page. For Claude, Gemini, Grok and DeepSeek, treat the number as a close estimate: the same paragraph will come out a little higher or lower on their side. Chat APIs also add a few tokens per message for roles and separators that no text-box counter can see. When a number has to match an invoice, call the vendor's own count-tokens endpoint with the exact request.

Reading the three parts

  • System prompt. If it is more than a few hundred tokens, read it again. Instructions written twice, long lists of examples and rules that never fire all cost tokens on every single turn. This is also the part prompt engineering improves most.
  • Knowledge. Usually the biggest block. Sending ten passages when three contain the answer triples the cost and gives the model more to get confused by. See retrieval-augmented generation for how the passages are chosen.
  • Conversation. Small at first and the only part that grows by itself. A long chat can overtake the knowledge block, and it is the usual reason a request that worked on turn two fails on turn twenty.

Budgeting a context window

A context window is shared between what you send and what comes back. A 128K window does not mean 128K of prompt: the reply has to fit in the same space, so set aside the longest answer you expect. The bar turns amber at 80% because a prompt that just fits today will not fit after a few more messages.

Large windows are not a reason to fill them. Cost rises with every token, some models charge a higher rate past a length threshold, and answers tend to get worse when the relevant sentence is buried in a very long prompt. A tight prompt is cheaper, faster and usually more accurate.

What the token view teaches

  • Common words are one token, often with the space in front attached.
  • Long, rare or invented words split into several pieces, as do product codes and names.
  • Numbers, URLs and JSON are expensive. Digits and punctuation tend to be a token each.
  • Formatting counts. Markdown symbols, indentation and line breaks are tokens too.
  • Language matters. The same sentence in German, Hindi or Japanese uses more tokens than in English.

If you are comparing providers after measuring your prompt, the AI models directory covers each one, and a website chatbot built in Conferbot lets you bring your own key for any of them.

Frequently asked questions

What is a token?

A token is the unit a language model reads and writes. It is a piece of text, often a whole short word, part of a longer word, a punctuation mark or a space plus a word. Models are limited and billed by tokens, not by characters or words, which is why counting them matters before you send a prompt.

How many tokens is a word?

In ordinary English prose, one token is about four characters, so 100 tokens is roughly 75 words. Rare words, names, code, numbers and URLs split into more tokens. Languages written without spaces, such as Chinese and Japanese, use about one token or more per character, so the same meaning costs more tokens.

Is this count exact?

For text encoded with OpenAI's o200k_base vocabulary it is the real tokenizer running in your browser, not an approximation. For Claude, Gemini, Grok and DeepSeek it is an estimate, because those vendors do not publish a tokenizer that runs in a browser. Their own counts for the same text will differ somewhat.

Why does the same text have different token counts on different models?

Each model family has its own vocabulary, built from its own training data. A word that is one token in one vocabulary may be two in another. Chat APIs also add a few hidden tokens per message for roles and formatting. For billing-exact numbers, use the vendor's own token counting endpoint.

What is a context window?

It is the most tokens a model can take in and produce in one request: your system prompt, the knowledge you attach, the whole conversation and the reply together. If the total goes over, the request fails or the oldest content is cut. Leave room for the reply when you measure a prompt.

Why count the system prompt, knowledge and conversation separately?

Because they behave differently. The system prompt is sent on every turn and can be cached. Knowledge is usually the largest part and the easiest to trim. Conversation history grows with every message. Seeing each part's share shows where to cut when a prompt is too long or too expensive.

Is my text sent to a server?

No. The tokenizer vocabulary is downloaded to your browser and the counting happens on your device. Nothing you paste is uploaded, logged or stored, and the page keeps working offline once it has loaded. That makes it safe for prompts that contain internal instructions or customer data.

How do I reduce the number of tokens in a prompt?

Remove repeated instructions and politeness from the system prompt, send fewer and shorter knowledge passages, summarise or drop old conversation turns, and prefer plain text over heavily formatted text, since markup characters are tokens too. Then ask for shorter replies, because every reply becomes input on the next turn.

Related

Skip the token budgeting

Conferbot retrieves the passages each question needs from your own content, so prompts stay short. Build an AI chatbot with no code, free plan, no card.