Skip to content

AI Token Counter

Paste a prompt to see roughly how many tokens it uses, whether it fits a model's context window, and what the API call is likely to cost.

Processed in your browser0 chars

Estimate

Tokens
0
Words
0
Characters
0
Lines
0

Likely range 00 tokens. Exact counts differ per model tokeniser.

Cost estimate

Prompt
$0.00
Completion
$0.00750
Per call
$0.00750

Context window fit

  • 8K0.0%
  • 32K0.0%
  • 128K0.0%
  • 200K0.0%
  • 1M0.0%

What is the AI Token Counter?

Language models do not read words, they read tokens — chunks of characters that sit somewhere between a letter and a word. 'Understanding' might be two tokens, 'the' is one, and a curly brace in a code block is usually its own. Every API bills per token, and every model caps how many it will accept at once, so token count is the number that actually governs what you can send and what it costs.

This tool estimates that count from your text and shows it alongside words, characters and lines. It also plots the result against common context-window sizes, so you can see at a glance whether a document will fit in an 8K window or needs a 200K one.

The estimate uses about four characters per token for prose and a denser ratio for code, which the tool detects from punctuation density. A likely range is shown beneath the figure rather than a single confident number, because the true count depends on which tokeniser the model uses.

Why is it Useful?

Cost adds up quietly. A prompt that looks short can carry a long system message, a few examples, and a pasted document; multiply that by thousands of calls and the difference between a tight prompt and a lazy one becomes a real bill. Checking the count before you ship a prompt is the cheapest optimisation available.

Context limits fail loudly. Sending more tokens than a model accepts returns an error or silently truncates your input, which is worse — you get an answer that ignored the end of your document without telling you. Knowing the size in advance avoids both.

The cost fields take your own prices rather than a built-in table. Model pricing changes often, and a hardcoded list would be wrong within months, so you enter the current rate from your provider's pricing page and the maths stays correct forever.

How to Use It

Paste your prompt, document or code into the box. Token, word, character and line counts update as you type.

Enter your model's input price per million tokens. Add the number of output tokens you expect and the output price to see the full per-call cost.

Check the context window row to confirm the prompt fits the model you plan to use. Bars turn red once the prompt exceeds that window.

Nothing you paste is transmitted. The counting runs in JavaScript on your own device.

How accurate is the estimate?

Expect the figure to land within roughly fifteen per cent of the true count for ordinary English prose, which is why a range is shown rather than one number. That is close enough for budgeting and for checking a document will fit a window.

Accuracy drops for text that tokenises unusually: dense code, long unbroken strings such as base64 or hashes, non-Latin scripts, and heavy emoji use all consume more tokens per character than plain English. If your input is mostly one of those, treat the figure as a floor.

For an exact count, run the text through the tokeniser your provider publishes for the specific model. An exact tokeniser is a large lookup table that would have to be downloaded before the page could work, which is a poor trade for a number most people need approximately.

Keep going

Related tools

More utilities that pair well with this one.

FAQ

Questions, answered

Everything you need to know about the AI Token Counter.

Around 1,300 tokens for ordinary English prose, using the common rule of roughly 0.75 words per token. Code, non-English text and long strings of digits or symbols run higher — often noticeably so.