Prompt Token Counter — Counts Locally, Your Text Never Leaves the Browser
Count the tokens of any prompt in real time. Exact BPE counting for GPT-4, GPT-4o and Llama 3 — all in your browser.
Your text
How it works
Paste or type your prompt and pick a model. The counter runs a real BPE tokenizer entirely on this page — your text is never uploaded. Token, character and word counts update on every keystroke; large inputs are processed in a Web Worker so typing stays smooth.
Why count tokens in the browser?
Token limits decide whether a prompt fits a model context window — and how much an API call costs. Counting locally lets you check any prompt, including confidential code or data, without sending it to a third-party service. The only thing this page sends is an anonymous usage ping: the tool name and the input size, never your content.
FAQ
- Is my text uploaded anywhere?
- No. Tokenization runs entirely in your browser in JavaScript — your prompt never leaves your device. The page only sends an anonymous usage counter (the tool name and the input size), never the text itself.
- How accurate is the count?
- Exact — 0% error — for GPT-4, GPT-4o and Llama 3: it runs the real BPE tokenizer with the official rank tables, fully offline. Claude uses a calibrated estimate, as Anthropic does not publish its tokenizer.
- Is there a size limit?
- Only your device memory. With no server you can count prompts of several megabytes; large inputs are tokenized in a Web Worker so the page never freezes.
- Does it work offline?
- Yes. After the first load the page and the tokenizer tables are cached by the browser, so the counter keeps working without any further network access.