Token Calculator — count LLM tokens
Paste any text and get the number of tokens a large language model would charge for. The count is computed entirely in your browser with the js-tiktoken GPT-2 encoder: the text is never uploaded, logged or stored anywhere.
Language models bill and truncate by token, not by word: roughly four characters of English make one token, while Hebrew, code and rare words cost more. Counting before you send a prompt is how you keep a request inside a context window and predict its price.
This page needs JavaScript to compute a count, because the encoder runs on your device. Agents can call the same capability as a WebMCP tool named count_tokens once the page has loaded.