Paste your text below to count tokens for any major AI model — free, instant, no signup required.
Token counts use a BPE approximation (cl100k_base). GPT-4o and Claude counts are typically within ±5% for English text. Gemini uses SentencePiece and may vary by ±8%. Your text is never sent to any server — all calculations happen in your browser.
A token is the fundamental unit of text that AI language models process. Unlike words or characters, tokens are produced by a byte-pair encoding (BPE) algorithm that merges common character sequences into single units. On average, one token corresponds to approximately four characters in English text, or roughly three-quarters of a word. As a practical example, the word "tokenization" is typically split into two tokens: "token" and "ization." Spaces, punctuation, and numbers are also tokenized, sometimes in ways that differ from natural language intuition — the number "1234" might become one token, while "1234567" might become three.
For standard English prose, approximately 1,300 to 1,500 tokens. The ratio is not exact because token boundaries don't align with word boundaries. Technical writing, code, and content with many numbers tends to use more tokens per word — code can run as high as 2 tokens per word due to special characters and operators. Simple conversational text tends to be closer to 1.2–1.3 tokens per word. As a rule of thumb for quick estimation: multiply your word count by 1.33 to get a reasonable token estimate for English prose.
Tokens matter for two critical reasons: cost and capacity. Every major AI API (OpenAI, Anthropic, Google) bills by token count — separately for input tokens (your prompt and conversation history) and output tokens (the model's response). Understanding your token usage lets you control costs precisely. The second reason is context window limits: every model has a maximum number of tokens it can process in a single API call. If your input plus expected output exceeds this limit, the API will return an error. Knowing your token count before making API calls prevents these errors and helps you architect efficient applications.
They are very similar but not identical. Both OpenAI GPT-4o and Anthropic Claude use variants of the cl100k_base tokenizer vocabulary, which means token counts for the same text will be extremely close — usually within 1–3%. However, small differences exist in how edge cases are handled, particularly around special characters, code, and non-English text. Google's Gemini models use a different tokenizer based on SentencePiece, which can produce noticeably different counts for the same text, especially for languages other than English or for structured formats like JSON and XML.
Context windows vary significantly between models. As of 2026: GPT-4o supports 128,000 tokens; GPT-4.1, Gemini 2.5 Pro, Gemini 2.5 Flash, and Gemini 2.0 Flash all support up to 1,000,000 tokens (1 million); Claude Opus 4.7, Claude Sonnet 4.6, and Claude Haiku 4.5 support 200,000 tokens; o3 and o4-mini support 200,000 tokens. For most use cases, even the 128K context of GPT-4o is more than sufficient. Use the model comparison table for a full up-to-date breakdown of each model's specifications.
This tool uses a BPE approximation algorithm that closely mimics the cl100k_base tokenizer used by GPT-4o and Claude. For typical English prose, accuracy is within ±5%. For code, the accuracy is similar. For non-Latin scripts (Chinese, Japanese, Arabic, etc.), the variance can be higher — up to ±15% — because SentencePiece-based tokenizers like Gemini's segment these languages very differently. For production applications where exact token counts matter (e.g., billing, context window management), use the official tokenizer libraries: tiktoken for OpenAI models, Anthropic's token counting API for Claude, or the Gemini API for Google models.
Several effective strategies exist for reducing token usage: First, minimize redundant whitespace and line breaks — each line break often becomes an extra token. Second, avoid repeating instructions across messages; put them in the system prompt once and keep them concise. Third, for structured data, use terse formats (JSON or CSV) rather than prose descriptions. Fourth, consider prompt caching: when you have a long system prompt that doesn't change between requests, providers like Anthropic and OpenAI offer cached input pricing at 50–80% discounts. Fifth, for long documents, consider chunking or summarizing rather than sending entire documents. Use this token counter to measure the impact of each optimization before and after.
Input tokens are everything you send to the model: your system prompt, conversation history, and the current user message. Output tokens are what the model generates in response. Almost all AI APIs price these separately, and output tokens are typically 3–5× more expensive than input tokens because text generation requires significantly more compute than text processing. For a GPT-4o call, input is priced at $2.50 per million tokens while output costs $10.00 per million — a 4× difference. When optimizing costs, focus first on output length: if you can achieve the same result with a shorter response, the savings are dramatic at scale.