DuckyTools
Home AI & Writing LLM Token Counter

LLM Token Counter AI & Writing

Estimate how many tokens a prompt will use, and how much of a context window it fills.

LLM Token Counter is a free online tool that estimate how many tokens a prompt will use, and how much of a context window it fills. It runs entirely in your web browser using plain JavaScript, so files are processed on your own device and never uploaded to a server. There is no sign-up, no file size limit imposed by the site, no watermark and no paid tier.

Price
Free — no account, no quota, no watermark
Category
AI & Writing
Where it runs
In your browser, on your device
Files uploaded
None
Technology
plain JavaScript
Settings
3
Works offline
Yes, after the first visit

About LLM Token Counter

Tokens are not words and not characters, which is why every "will this fit?" question needs an actual estimate. English prose runs roughly four characters or three-quarters of a word per token. Code is denser — closer to three characters — because punctuation and indentation each cost something. Chinese, Japanese and Korean are dramatically worse, often approaching one token per character, so the same passage can cost three times more in translation than in English.

How to use it

  1. Paste or type your text. Every figure recalculates on each keystroke.
  2. Use the sample button to see what the numbers look like on real prose.

The 3 settings

SettingWhat it doesDefault
Content is mostlyChoose from 2: Prose or chat, Code or markup.Prose or chat
Context windowChoose from 5: 8K, 32K, 128K, 200K, 1M.128K
Reserve for the responseRange 0–200000.4000

Under the hood

Runs onplain JavaScript — runs the whole thing
ControlsContent is mostly, Context window, Reserve for the response

Questions

How accurate is the estimate?

Within about 10–15% for ordinary text. It uses published character ratios rather than a real byte-pair-encoding vocabulary, because a real vocabulary is several megabytes and downloading it to answer "does this fit" is not a fair trade. Good enough to plan a prompt; not good enough to reconcile an invoice.

Why reserve tokens for the response?

Because the context window holds the prompt and the answer together. Filling 127K of a 128K window leaves room for about a sentence. Reserving what you expect the model to produce is the difference between a truncated answer and a working one.

Does a bigger context window mean I should use it?

Usually not. Long contexts cost more on every call and measurably degrade accuracy in the middle of the input — the well-documented "lost in the middle" effect. A tightly scoped prompt beats a large one at the same task more often than people expect.

Why is my non-English text so much more expensive?

Tokenizers are trained predominantly on English, so other scripts fragment into more tokens. CJK characters often cost about one token each against English prose at four characters per token — the same meaning, several times the price.