LLM Token Counter & API Cost Estimator
Estimate the token count of any text and see estimated API costs across 10 major language models at a glance. Essential for prompt engineering and budget planning.
What Is a Token in LLMs
Language models do not process text character by character — they process tokens, which are chunks of text corresponding to common words, word fragments or punctuation. The word 'running' might be one token. 'Unbelievable' might be split into 'un', 'believ', 'able' — three tokens. On average, one token corresponds to about 4 characters or 0.75 words in English. For code, JSON and structured text, token counts can be significantly higher per character.
Why Token Counting Matters
API pricing is per token. A 128,000-token context window has a cost ceiling. Long prompts consume context leaving less room for output. Understanding your prompt's token count helps you optimise costs, avoid hitting context limits, and design efficient prompts. This tool uses a cl100k_base approximation — close to GPT-4 and Claude tokenisation but not identical to any specific model.