← All tools

LLM Token Counter

Paste text to estimate how many tokens it uses and what it would cost to send to popular LLM APIs. Everything runs in your browser — nothing is uploaded.

Estimate blends characters ÷ 4 with words × 1.33 — typically within ±10–15% of a real tokenizer. It is not the model's actual tokenizer.
0
Tokens (est)
0
Characters
0
Words
0
Sentences
0
Paragraphs

Cost estimate — editable rates ($ per 1M tokens)

Rates change — edit them to match current pricing. Prefilled with representative mid-2026 prices, not live data.
Model Input $/1M Output $/1M Cost as input Cost as output

About this tool

Token counts here are estimates: the text is segmented into words and punctuation with a regex, then a character-based count (characters ÷ 4) is blended with a word-based count (words × 1.33). For typical English prose this lands within about 10–15% of what tokenizers like tiktoken produce, but it is not the model's real tokenizer — code, non-English text, and unusual formatting can drift further. The cost table multiplies the estimate by editable per-million-token rates; the prefilled numbers are representative mid-2026 prices, so always check your provider's pricing page before budgeting.

Your text never leaves the page — there is no server, no upload, and no tracking of tool inputs. Counting and cost math happen entirely in your browser.

Frequently asked questions

How accurate is this token count?

It is an estimate, not a tokenizer. The tool blends a character-based count (characters ÷ 4) with a word-based count (words × 1.33), which typically lands within ±10–15% of a real tokenizer for English prose. Code, non-English text, and heavy formatting can drift further. For exact numbers, use the provider's own tokenizer or token-counting API — and always leave headroom when you are near a context limit.

What exactly is a token?

LLMs read text as subword units produced by a tokenizer such as BPE: common words are often one token, rarer words split into several pieces, and punctuation and whitespace count too. For typical English, one token averages about 4 characters or 0.75 words — the rule of thumb this tool's estimate is built on.

Do different models count tokens differently?

Yes. Each model family has its own tokenizer and vocabulary — OpenAI's tiktoken encodings, Anthropic's and Google's tokenizers all segment text differently — so the same text produces different counts on different models, usually within a modest range. A model-agnostic estimate like this one can't match any of them exactly, which is another reason to budget with margin.

Why do code and non-English text use more tokens?

Tokenizer vocabularies are trained mostly on English text, so anything unusual splits into more, smaller pieces: indentation and symbols in code, accented or non-Latin scripts, and languages like Hindi or Thai can take several times more tokens per character than English. JSON is a notable offender — every quote, brace, and key name costs tokens, so verbose payloads inflate quickly.

How do I turn a token count into an API cost?

Providers price per million tokens, with separate input and output rates — output typically costs 3–5× more than input. Multiply your token count by the rate and divide by one million; the editable table on this page does that per model. For per-call, per-thousand-calls, and monthly projections across models, the AI Prompt Cost Calculator on this site goes further.

Found this useful? 113 free, browser-only tools by Yuvrajsinh Jadav — an engineer who ships production AI systems. No account, nothing sent anywhere.