Token Calculator for LLMs
Estimate token usage and API costs for OpenAI, Anthropic, Google, Meta, and more. Understand your prompt costs before you run them.
Paste text or file here
Result Statistics
Cost Estimation
What is a token calculator?
A token calculator helps developers and businesses estimate the cost of using Large Language Models (LLMs) like GPT-4, Claude, or Gemini. Models process text in chunks called "tokens", not words or characters. A token is typically around 4 characters in English, or about 0.75 of a word.
By pasting your prompt into our calculator, we use the specific tokenization logic (like OpenAI's cl100k_base) to give you an exact count. We then apply the latest per-million token pricing from the model providers to give you an accurate cost estimation before you execute your API calls.
How to use the token calculator
- 1Paste your text: Copy and paste your prompt, code, or document into the large text area above.
- 2View exact token counts: The tool instantly processes your text and displays the exact token count.
- 3Calculate API costs: Select your target provider and model in the right sidebar to see exactly how much the request will cost.
Compare Token Costs
A comprehensive breakdown of pricing across major LLM providers. Prices are per 1 Million tokens.
| Provider | Model | Context Window | Input Cost (/1M) | Output Cost (/1M) | Tokenizer | Training Data |
|---|---|---|---|---|---|---|
O OpenAI | GPT-4o | 128K | $5.00 | $15.00 | cl100k_base | Oct 2023 |
O OpenAI | GPT-4 Turbo | 128K | $10.00 | $30.00 | cl100k_base | Dec 2023 |
O OpenAI | GPT-4 | 8K | $30.00 | $60.00 | cl100k_base | Sep 2021 |
O OpenAI | GPT-3.5 Turbo | 16K | $0.50 | $1.50 | cl100k_base | Sep 2021 |
A Anthropic | Claude 3.5 Sonnet | 200K | $3.00 | $15.00 | Claude | Apr 2024 |
A Anthropic | Claude 3 Opus | 200K | $15.00 | $75.00 | Claude | Aug 2023 |
A Anthropic | Claude 3 Sonnet | 200K | $3.00 | $15.00 | Claude | Aug 2023 |
A Anthropic | Claude 3 Haiku | 200K | $0.25 | $1.25 | Claude | Aug 2023 |
G Google | Gemini 1.5 Pro | 2M | $3.50 | $10.50 | Gemini | Early 2024 |
G Google | Gemini 1.5 Flash | 1M | $0.07 | $0.30 | Gemini | Early 2024 |
G Google | Gemini 1.0 Pro | 32K | $0.50 | $1.50 | Gemini | Early 2023 |
M Meta | Llama 3 (70B) | 8K | $0.50 | $0.50 | Llama 3 | Mar 2024 |
M Meta | Llama 3 (8B) | 8K | $0.05 | $0.05 | Llama 3 | Mar 2024 |
M Mistral | Mistral Large | 32K | $4.00 | $12.00 | Mistral | Late 2023 |
M Mistral | Mixtral 8x22B | 65K | $0.90 | $0.90 | Mistral | Late 2023 |
C Cohere | Command R+ | 128K | $3.00 | $15.00 | Cohere | Early 2024 |
C Cohere | Command R | 128K | $0.50 | $1.50 | Cohere | Early 2024 |
Token Calculator FAQ
How accurate is the token count?
For OpenAI models, we use the exact `cl100k_base` tokenizer, meaning the count is 100% accurate. For Anthropic and Google, we use highly tuned heuristics as their tokenizers are proprietary. Expect ~95% accuracy for non-OpenAI models.
Are prices automatically updated?
We regularly review and update the pricing table to reflect the latest API costs from major providers. However, for large-scale production workloads, always verify against the provider's official pricing page.
What is a Context Window?
The context window represents the maximum number of tokens a model can process in a single request. This includes both your input prompt and the model's generated output.
Is my data sent to any servers?
No. The token calculator processes all text entirely within your browser using client-side JavaScript. Your prompts and sensitive data are never transmitted to our servers.