LLM token and cost calculator
Estimate how many tokens a pasted text costs across popular LLM APIs.
LLM token and cost calculator
Paste a prompt, document or chat transcript and this tool estimates how many tokens it would consume, then converts that into an approximate dollar cost across a handful of popular models — GPT-4o, GPT-4o mini, Claude Sonnet, Claude Haiku and Claude Opus. It's built for quick sanity checks before sending a large batch of requests through an API, not as a substitute for the exact usage numbers a provider's dashboard reports afterward.
Token counting here is a heuristic, not an exact count. Real tokenizers use byte-pair encoding trained on huge corpora, and reproducing one client-side would mean shipping megabytes of merge tables for one feature. Instead, this tool applies the rule of thumb most API docs quote — roughly four characters or three-quarters of a word per token for English and other Latin-script languages — and switches to a denser ratio for CJK text (Chinese, Japanese, Korean), where a character commonly maps to close to one token instead of a quarter. Mixed text is classified character by character, so a paragraph switching between English and Japanese gets a blended estimate.
Reference prices are hardcoded at what each provider listed when this tool was built, shown per million tokens. Toggle "Price as output tokens" to price the same count at each model's output rate instead — output is consistently priced higher than input, which matters when estimating a completion rather than a prompt. The table updates as you type, so trimming a prompt shows its effect across every model at once.
Everything runs locally: the text you paste is never uploaded anywhere, so it's safe to use on a prompt containing confidential material. Because the token count is an estimate, treat the numbers as a planning aid — for exact billing, check the usage your API provider actually reports.