Token counter

Paste your text and get an estimate of its tokens, with a likely range, plus characters and words. Set a context limit to see how much of it you use, and a price to see the cost.

  • Free
  • No sign-up
  • Runs in your browser
token-counter
Optional
Optional, from your provider

Fill in the values above to see the result.

100% private — the calculation is done in your browser and nothing is sent to any server.

How it works

Paste the text

A prompt, a document or some code.

Choose the kind of text

Prose, code or another language changes the estimate.

Compare with your limit

Set a context limit or a price for extra numbers.

How many tokens is my text?

AI language models do not read letters or words but tokens, chunks of text that can be a whole common word, part of a longer word, a number or a symbol. Prompts, documents and answers are all measured in tokens. Limits, such as how much a model can take in at once, and prices are set in tokens too. Knowing roughly how many tokens a text uses helps you check that it fits in a context window and estimate what a request will cost.

An estimate, not an exact count

Every model family has its own tokenizer, so the exact count of the same text differs between them. This tool does not run any of those tokenizers. It estimates from the number of characters and words, using typical ratios: around four characters per token in English prose, fewer in Spanish and other languages with longer words and accents, and fewer again in code and JSON, where symbols and short names cost more. It gives you a most likely value and a range around it. For an exact figure, use the tokenizer or the token counting function of your provider.

What you can do with it

  • Check a context limit. Set the size of the window, or pick a common one, and see what share of it your text uses and how many tokens are left, remembering that the answer also needs room.
  • Estimate a cost. Enter the input price per million tokens and get the cost of sending this text once.
  • Trim a prompt. Seeing the size while you edit is a quick way to bring a long prompt down to a budget.

Rules of thumb

In English, a token is about three quarters of a word, so 100 tokens are roughly 75 words. Text in Chinese, Japanese and Korean usually takes about one token per character or slightly more, which the tool accounts for. Numbers, URLs, rare words and unusual formatting split into many tokens, so text full of them is larger than it looks.

Limits

Because it is an estimate, leave a safety margin, such as ten to twenty percent, when you are close to a limit. The count does not include hidden parts of a real request, like system instructions, tool definitions or the format of the conversation. Your text is analyzed in your browser and is not uploaded. To turn tokens into money for a whole application, use the AI API cost calculator.

Frequently asked questions

How many tokens is a word?
In English, about 1.3 tokens per word on average, or roughly four characters per token. Other languages and code use more.
Is this the exact token count?
No. Each model has its own tokenizer, so this is an estimate with a likely range. Use your provider's tokenizer for an exact number.
How can I know if my text fits in a context window?
Set the context limit or pick a common size. The tool shows the share used and the tokens left, but keep room for the answer.
Why does code have more tokens than prose?
Symbols, short variable names, numbers and indentation are split into many small tokens, so code has fewer characters per token.
How do I estimate the cost of a prompt?
Enter the input price per million tokens from your provider. The tool gives the cost of sending the text once.
Is my text sent anywhere?
No. It is analyzed in your browser.