LLM Token Calculator
Estimate token counts for any text or code, compare token-to-cost across 40+ models, and get prompt optimization suggestions to reduce your API bill. Supports word, character, and code-aware estimation modes.
Enter Your Text
Cost Across Models (per request)
Token Estimation Reference
| Content Type | Tokens / Word | Tokens / Character | Example |
|---|---|---|---|
| English prose | ~1.3 | ~0.25 | "Hello world" = 2 tokens |
| Code (Python/JS) | ~1.5 | ~0.29 | "def foo():" = 5 tokens |
| Non-English (Hindi, Japanese) | ~2.0 | ~0.5 | More tokens per character |
| JSON / structured data | ~1.4 | ~0.27 | Keys + values each tokenize |
| Markdown with code blocks | ~1.4 | ~0.28 | Mixed text + code |
Rules of Thumb
- 1 token ≈ 4 characters of English text
- 1 token ≈ 0.75 words
- 100 tokens ≈ 75 words ≈ a short paragraph
- 1,000 tokens ≈ 750 words ≈ ~2 pages of text
- Code and non-English text use 1.5-2× more tokens
Prompt Optimization Suggestions
When you click "Estimate", the calculator analyzes your text and suggests ways to reduce token usage. Common savings:
- Move static instructions to a cached system prompt: Save 40% on repeated context
- Remove politeness filler: "please", "kindly", "thank you" add ~5% tokens with no quality gain
- Limit few-shot examples to 2: More examples rarely improve quality proportionally
- Compress multi-line context into bullets: Save ~20% on verbose context
- Shorten role-play preambles: A one-line persona is usually enough
FAQ
How many tokens is 1000 words?
Approximately 1,330 tokens. The rule of thumb is 1 word ≈ 1.33 tokens, or 1 token ≈ 0.75 words (4 characters). For code, expect ~1,500 tokens per 1000 words.
How are tokens counted?
Tokens are sub-word units produced by a tokenizer (BPE for GPT, SentencePiece for Llama). Common words are 1 token; rare words split into multiple tokens. Code and non-English text use more tokens per character because they contain more unique sub-words.
Is this estimator exact?
No — it's a close approximation. Exact token counts require the provider's tokenizer (tiktoken for OpenAI). This estimator is within ±10% for English text and ±15% for code. For production billing, always use the actual tokenizer.
How do I reduce token usage?
Remove politeness filler, limit few-shot examples to 2, compress multi-line context into bullets, use prompt caching for static prefixes, and right-size your model (use a nano model for classification, a flagship only for complex reasoning).
Why do code and non-English text use more tokens?
Tokenizers are trained mostly on English prose. Code contains many unique sub-words (operators, identifiers), and non-English languages have different character sets that split into more tokens per character.