Token Counter
Runs in browserEstimate LLM token usage and input cost for GPT-4, Claude, and more.
Count approximate tokens for GPT-4, GPT-3.5, Claude, and Llama prompts. See words, characters, estimated input cost, and context usage before calling an API.
Token Counter tool
Tokens
59
Characters
235
Words
34
Input cost
$0.000295
| Model | Input tokens | Input cost | Est. output (2×) | Output cost | Total |
|---|---|---|---|---|---|
| GPT-4oselected | 59 | $0.000295 | 118 | $0.001770 | $0.002065 |
| GPT-4o mini | 59 | $0.000009 | 118 | $0.000071 | $0.000080 |
| GPT-4 | 59 | $0.001770 | 118 | $0.007080 | $0.008850 |
| Claude 3.5 Sonnet | 59 | $0.000177 | 118 | $0.001770 | $0.001947 |
| Claude 3 Opus | 59 | $0.000885 | 118 | $0.008850 | $0.009735 |
| Gemini 1.5 Pro | 59 | $0.000074 | 118 | $0.000590 | $0.000664 |
| Llama 3 70B | 59 | Free | 118 | Free | Free |
| Mistral Large | 59 | $0.000472 | 118 | $0.002832 | $0.003304 |
Approximate tokenization: ~1 token per 4 English characters. Models marked ≈ use GPT-4 tokenizer as approximation. Actual API counts may vary by ±5%.
🔒 Runs in your browser · No uploads · Your data never leaves your device
How to use
Pick model
Select GPT-4o, GPT-3.5, Claude Sonnet, or Llama 2 to apply model pricing and context limits.
Paste prompt
Token, word, and character stats update in real time while you edit.
Check limits
Use the context progress bar and warning to trim prompts before sending requests.
Common use cases
- Checking prompt fits within context window — Verify a prompt doesn't exceed the model's token limit before sending the API request.
- Estimating API cost before deployment — Calculate input tokens for a typical prompt to estimate per-call cost before scaling to production.
Examples
Code review prompt
Typical engineering prompt.
InputYou are a helpful assistant...Output~50 tokens (approx)
Frequently asked questions
- Is this exact tokenization?
- No. It uses a fast approximation (about 1 token per 4 characters for English).
- Why estimate cost from input only?
- Output token usage depends on model response length, which is unknown ahead of time.
Key concepts
- Token
- The basic unit of text an LLM processes — roughly 4 English characters or 3/4 of a word on average.
- Context window
- The maximum number of tokens an LLM can process in a single request, including both input and output.
Related tools
You might find these useful too.
- System Prompt Builder
Build reusable LLM system prompts from structured templates.
Open - JSON Formatter
Format and validate JSON instantly.
Open - Cursor Rules Generator
Generate .cursorrules files for Cursor AI from your tech stack.
Open - LLM Cost Calculator
Compare LLM API pricing for GPT-4, Claude, Gemini, and more.
Open