Paste text to count tokens
Cost estimates update live across all major models
About
The Token Counter uses the gpt-tokenizer library (MIT-licensed, pure JavaScript) to count exact GPT tokens via the cl100k_base and o200k_base encodings. Claude token counts use a calibrated approximation (words × 1.33) and Gemini uses characters ÷ 4 — both are disclosed inline. The tool shows token count, character count, word count, and line count for the input text, plus a results table listing all 10 supported models with their tokens, input cost estimate, output cost estimate, and a context-window utilization bar. All processing is local — your text never leaves the browser.
How to use
- 1 Paste or type your text in the editor on the left.
- 2 Instantly see the token count, character count, and word count update for all models.
- 3 Review the per-model table showing exact or approximate token counts and cost estimates.
- 4 The context bar shows what percentage of each model's context window your text occupies.
- 5 Note: GPT models use exact tiktoken counts; Claude and Gemini use disclosed approximations.
- How is the token count calculated?
- For GPT-3.5, GPT-4, and GPT-4o we use cl100k_base BPE encoding via gpt-tokenizer (MIT license, runs entirely in your browser). GPT-4o-mini uses o200k_base. Claude uses words × 1.33 (Anthropic's published approximation). Gemini uses characters ÷ 4.
- Why do different models give different token counts for the same text?
- Each model uses a different tokenizer with a different vocabulary. GPT uses BPE (Byte Pair Encoding), Claude uses a similar BPE vocabulary but different merges, Gemini uses SentencePiece. The same word may tokenize differently — for example, "tokenization" could be 1 token (GPT-4) or 2 tokens in older models.
- What is the context window?
- The context window is the maximum number of tokens a model can process in a single request — both your prompt (input) and the generated response (output) must fit within it. Exceeding the context window causes truncation or an API error.
- Is my text sent to any server?
- No. All tokenization runs in your browser using a WebAssembly/JavaScript library. Your text is never sent to Anthropic, OpenAI, Google, or any other service.