LLM Token Calculator
Convert between tokens, words, and characters for any LLM. Instantly estimate API costs for GPT-4, Claude, Gemini, and Llama. Paste your prompt and see the cost before you send it.
—
Send feedback
💡 Share your idea or report a problem
✓ Thanks! We'll take a look.
Learn more
How It Works
The formula, explained simply
Large language models do not process words or characters — they process tokens, which are sub-word units generated by a tokeniser. Common words are usually one token; rare words are split into two or more. The word "figuring" might be one token, while "tokenisation" might be split into "token", "is", "ation".
This calculator uses the standard approximation: 1 token ≈ 4 characters ≈ 0.75 words for English prose. It is accurate to within 5–10% for typical prompts. Code, URLs, and non-English text may differ.
API providers charge separately for input tokens (your prompt, context, and system instructions) and output tokens (the model's response). Output tokens typically cost 3–5× more than input tokens.
When To Use This
Right tool, right situation
Use this calculator when: estimating API costs before building a product; comparing model pricing for a specific use case; checking whether a document fits in a context window; or planning your LLM budget for a given call volume.
When to use something else: For exact token counts in production, use the provider's official tokeniser. OpenAI's tiktoken library is free and accurate to the token. For cost tracking in production, use your provider's usage dashboard.
Common Mistakes
Why results sometimes look wrong
Ignoring system prompts in cost estimates. Your system prompt runs on every single API call. A 1,000-token system prompt on 10,000 daily calls adds 10M extra tokens — ~$25/day on GPT-4o.
Using GPT-4 class models for simple tasks. For classification, extraction, or simple Q&A, GPT-3.5 Turbo or Claude Haiku deliver 90% of the quality at 5–20% of the cost.
Not accounting for conversation history. Multi-turn chatbots resend the full conversation on every turn. A 10-turn conversation resends turns 1–9 as context for turn 10. Costs grow quadratically without a sliding window or summarisation strategy.
Treating token estimates as exact. This calculator approximates. For billing-critical production work, use the model provider's official tokeniser library (tiktoken for OpenAI).
The Math
Worked examples and deeper derivation
Token cost = (input_tokens / 1,000,000) × input_price + (output_tokens / 1,000,000) × output_price
Input tokens ≈ character_count / 4. Output tokens ≈ expected_words / 0.75.
Context window matters: every token in your context (system prompt, conversation history, documents) adds to input costs. A 128K context window can hold ~96,000 words — useful for long-document analysis, but filling it costs proportionally more.
At 10,000 API calls/day with a 500-word prompt, you consume ~6.67M input tokens daily. On GPT-4o at $2.50/MTok, that is $16.75/day ($508/month) in input costs alone — before output tokens. Model selection is the biggest cost lever at scale.
Common questions
Need something this doesn't cover?
Suggest a tool — we'll build it →