🔢 AI Token Calculator
Estimate tokens from any text length, see how much context window it fills, and what a single request costs.
How Token Estimation Works
LLMs don't read characters or words — they read tokens, sub-word chunks averaging ~4 characters in English. Every API bill, context limit, and rate limit is denominated in tokens, so estimating them is step zero of AI cost control.
The Rules of Thumb
Window % = Tokens ÷ Context Window × 100
Estimates vary by content: code and non-English text tokenize less efficiently (more tokens per character), while plain English is close to 4 chars/token. For exact counts use a tokenizer (tiktoken); for budgeting, this approximation is within ~10%. Remember outputs count against the window too.
Worked Example
100,000 characters ≈ 25,000 tokens (~18,750 words, ~50 pages). In a 128K window that fills 19.5%. At $1.25/M input, one such request costs $0.031 in input tokens — about 3 cents. A million tokens is roughly 40 novels' worth of text.
Where Token Estimates Break Down
The ÷4 rule is for English prose. Code tokenizes ~30–50% worse (whitespace and symbols fragment into more tokens), non-Latin scripts and emoji far worse — budget 2–3× for multilingual apps. Images consume tokens too: vision models tile images and charge per tile (a detailed screenshot can cost 1,000+ tokens before a word is read). The silent budget-killer is conversation history: every turn resends the full transcript, so a 20-turn chat costs roughly 20× the average turn length in input tokens — summarize or truncate history aggressively. For exact counts, run the tiktoken library (OpenAI) or each provider's tokenizer; for architecture decisions, this estimate is plenty. Remember the window is shared: input + output + thinking must all fit, so a "128K window" with 100K of history leaves little room to generate.
Plan for growth: prototype prompts are short; production prompts balloon with few-shot examples, tool schemas, and retrieved context (RAG). Multiply your prototype token estimate by 3–5× when budgeting production — retrieval-augmented apps routinely send 10,000+ tokens of context per request before generating a single word.
Frequently Asked Questions (FAQs)
How many tokens are in 1,000 words?
About 1,333 tokens for typical English prose (words × 1.33). Code can run 1,500–2,000 tokens per 1,000 words.
What is a context window?
The maximum tokens a model can consider in one request — input plus output combined. 128K ≈ 300 pages; 1M ≈ 1,500 pages of text.
Why do tokens matter for cost?
APIs bill per token, so token count × price = your bill. Long system prompts and chat histories silently inflate every request's input tokens.
Is this exact?
No — it's an estimate within ~10% for English prose. Exact tokenization depends on the model's tokenizer (tiktoken for OpenAI, different ones for Claude/Gemini).
How do I reduce token usage?
Trim system prompts, summarize chat history instead of resending it, use prompt caching for repeated prefixes, and pick smaller models for simple subtasks.
Last updated: September 2026