Exact counts and estimates
Characters, characters excluding whitespace, grapheme clusters, lines and UTF-8 bytes are exact for the text in the box. Words depend on a definition: where the browser supports it, words are found with Unicode word segmentation, which also splits Chinese and Japanese text that has no spaces; otherwise they are runs of non-whitespace characters. Tokens are different: the number of tokens depends on the specific model’s vocabulary, and the estimate does not use one. An optional exact tokenizer for OpenAI’s o200k_base and cl100k_base encodings can be loaded further down the page; it is exact only for those two encodings.
Exact mode, model table and cost
The optional exact tokenizer implements byte-pair encoding for OpenAI’s o200k_base and cl100k_base encodings using the published tiktoken rank tables (MIT licence, stored on this site). It downloads only when you click a button (or on later visits, if you tick the box to load it automatically on this device), runs in a background worker, and never sends your text anywhere. Once it is loaded, the Token view shows the first 1,000 tokens of a text of up to 20,000 characters as coloured segments with their token IDs, so you can see exactly where the tokenizer splits your text. It is exact for those encodings only. Anthropic, Google and other vendors use different tokenizers, so their figures stay estimates. The model table lists context windows and prices that were entered by hand from each vendor’s documentation on the date shown; cost is tokens multiplied by the price per million tokens, with the assumptions shown, and a value that could not be confirmed is shown as unknown.
For valid JSON the page also shows the same data as compact JSON, pretty JSON, TOON and YAML with character counts and token counts side by side. Token differences between formats are only reliable with the exact tokenizer; with estimates they are rough. Limits: exact counting accepts up to 5 million characters, and the TOON and YAML conversion runs only for JSON up to 150,000 characters.
How the token estimate works
The estimate multiplies the count of each kind of character by a rough tokens-per-character weight: about a quarter of a token for English letters, more for digits and punctuation, about one token per Chinese, Japanese or Korean character, several for an emoji, and so on. Code and JSON use heavier weights for punctuation and line breaks than prose does. The tool also shows two common rules of thumb for comparison, characters divided by 4 and words divided by 0.75, and a plausible range around the estimate.
Limitations
- The weights are approximations tuned for typical English prose and source code. They are not calibrated to any model, so treat the number as an order of magnitude with a margin of error.
- Non-English text is the least reliable. Urdu, Arabic, Hindi, Chinese, Japanese, Korean and emoji are tokenized very differently across models, and newer tokenizers are often more efficient than older ones. The range widens automatically when much of the text is not Latin script.
- Real systems add tokens that never appear in your text: message framing, system prompts, tool definitions and images.
- Content type affects the estimate. Auto-detection is a guess from the text; choose the type yourself if it is wrong.
- Line breaks in the box are normalised to a single newline. A Windows file with CRLF endings is one byte per line larger on disk than the byte count shown. When you open a file, its size on disk is shown separately.
- Very long texts: above 500,000 characters, grapheme and word segmentation are skipped and words are counted by whitespace to keep the page responsive.
JSON sizes
When the text is valid JSON, the tool shows its size as written, with all optional whitespace removed (compact) and pretty-printed with a 2-space indent. Strings and numbers are copied exactly as written, so large numbers and key order are never changed. Sending compact JSON to an API usually uses fewer bytes and tokens than pretty JSON.
Privacy
All counting and estimating happens in your browser. Your text is not uploaded, not sent to any AI API and not saved. Downloaded reports contain only the numbers, never your text.