Token Counter
Estimate token count for GPT, Claude, Llama, Gemini, and Mistral models. See context window usage and input cost estimates.
Tokens (est.)
37
Characters
114
Words
20
Lines
1
Token count is an approximation using a BPE-style heuristic. Actual counts may vary ±5% across models.
0.0% of context window used
0.0% of context window used
0.0% of context window used
0.0% of context window used
| Model | Provider | Context | Usage | Input cost | $/1K input |
|---|---|---|---|---|---|
| GPT-4o | OpenAI | 128K | 0.0% | $0.00018 | $0.00500 |
| GPT-4 Turbo | OpenAI | 128K | 0.0% | $0.00037 | $0.01000 |
| GPT-3.5 Turbo | OpenAI | 16K | 0.2% | $0.00002 | $0.00050 |
| Claude 3.5 Sonnet | Anthropic | 200K | 0.0% | $0.00011 | $0.00300 |
| Claude 3 Opus | Anthropic | 200K | 0.0% | $0.00055 | $0.01500 |
| Claude 3 Haiku | Anthropic | 200K | 0.0% | < $0.00001 | $0.00025 |
| Gemini 1.5 Pro | 1000K | 0.0% | $0.00005 | $0.00125 | |
| Gemini 1.5 Flash | 1000K | 0.0% | < $0.00001 | $0.00007 | |
| Llama 3.1 405B | Meta | 128K | 0.0% | $0.00011 | $0.00300 |
| Llama 3.1 70B | Meta | 128K | 0.0% | $0.00003 | $0.00090 |
| Mistral Large | Mistral | 128K | 0.0% | $0.00011 | $0.00300 |
| Mixtral 8x7B | Mistral | 33K | 0.1% | $0.00003 | $0.00070 |
Prices are approximate and may have changed. Check provider pricing pages for exact rates.
Free online token counter for GPT-4, Claude, Gemini, Llama, and Mistral with cost estimates
Knowing how many tokens your prompt consumes is essential for avoiding context window overflows, budgeting API costs, and optimizing long-running LLM workflows. The Token Counter on AlteredIdea estimates token counts using a BPE-style heuristic and maps them against the context windows and pricing of 12 popular models across OpenAI, Anthropic, Google, Meta, and Mistral: all running instantly in your browser without any API calls.
The tool is particularly useful for developers building LLM-powered applications who need to ensure prompts stay within model limits, content teams managing API spend, and researchers benchmarking how different models handle the same input. The context window usage bars make it immediately clear which models can handle your prompt and which ones are at risk of truncation.
Step-by-step guide
- 1Paste your text or prompt
Type or paste any text: a prompt, system message, document, or conversation: into the Text Input panel. The token count updates in real time as you type. - 2Read the token estimate
The large Token (est.) counter at the top shows the approximate token count using a BPE-style heuristic. Character, word, and line counts are also shown. - 3Select models to compare
Toggle individual model chips to choose which models appear in the comparison view. You can also click 'Show all models' to see all 12 supported models at once. - 4Check context window usage
Each model card shows a progress bar indicating what percentage of that model's context window your text fills. Red means over 90% full: a prompt that may be truncated. - 5Review cost estimates
The cost table at the bottom shows estimated input costs at current token count across all models. Useful for budgeting API usage before running large batches.
Related Tools
AI Detector
Analyze text for AI-generated patterns using heuristic scoring: sentence uniformity, vocabulary richness, formal phrasing, and more.
Prompt Builder
Compose structured prompts with system message, user turn, few-shot examples, and output format. Export as JSON or plain text.
Readability Analyzer
Score text with Flesch Reading Ease, Flesch-Kincaid Grade, Gunning Fog, and SMOG. Get detailed stats on sentences, words, and syllables.
Prompt Library
Save, organize, tag, and reuse your best prompts locally. Search by tag or keyword: stored entirely in your browser, no account needed.
Frequently Asked Questions
- How accurate is the token count?
- The token count is an approximation using a BPE-style (Byte Pair Encoding) heuristic. It is typically accurate within ±5% for English text. Exact token counts vary by model: each model family uses its own tokenizer. For precise counts, use the official tokenizer for your specific model.
- Which models are supported?
- The tool covers 12 models across 5 providers: GPT-4o, GPT-4 Turbo, GPT-3.5 Turbo (OpenAI); Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku (Anthropic); Gemini 1.5 Pro, Gemini 1.5 Flash (Google); Llama 3.1 405B and 70B (Meta); and Mistral Large and Mixtral 8x7B.
- What is a context window?
- A context window is the maximum number of tokens an LLM can process in a single request: including your system prompt, conversation history, and the response it generates. Exceeding the context window causes the model to truncate older content, which can lead to incoherent responses.
- How are input costs calculated?
- Input costs are calculated as (token count / 1000) × (price per 1K input tokens). The prices shown are approximate and based on publicly listed API pricing. Always check your provider's current pricing page for exact rates before budgeting.
- What is tokenization?
- Tokenization is the process of splitting text into tokens: the basic units an LLM processes. Tokens are not the same as words. A single word like 'tokenization' may be split into multiple tokens, while short common words like 'the' are typically a single token. English text averages roughly 0.75 words per token.
- Why does Claude have a larger context window than GPT-4?
- Claude 3.5 Sonnet and other Claude models support a 200,000-token context window, compared to 128,000 for GPT-4o. Gemini 1.5 Pro and Flash support up to 1,000,000 tokens. Larger context windows allow processing of entire books, codebases, or long conversation histories.
- How do I reduce token count to stay within a model's limit?
- Common strategies include: removing redundant context from conversation history, using the Stopwords Remover tool to strip filler words from prompts, summarizing earlier conversation turns, and being more concise in system prompt instructions.
- Can I use this to estimate costs before an API call?
- Yes. Paste your full prompt (including system message and any context) to get an estimated input token count, then multiply by your model's per-token rate to estimate the cost. The built-in cost table does this automatically for all supported models.
- Do different languages use more tokens?
- Yes. Non-English languages, especially those with non-Latin scripts like Chinese, Japanese, Arabic, and Korean, typically use more tokens per word or character than English. This means the same content in a non-English language will consume more context window space.
AlteredIdea vs alternatives
vs ChatGPT / LLM APIs: API calls cost money and only report tokens after the fact. AlteredIdea estimates token count before you make any API call, across 12 models simultaneously.
vs browser extensions: No install, no permissions, works on any device.
vs paid tools: Completely free, no account required.