DevToolsmith

Token Counter

Count text tokens locally and estimate input, cached-input and output costs. Choose a verified model encoding or custom prices; use manual token counts for Claude and models without a matching local tokenizer.

Runs 100% in your browser — nothing is uploaded

A newer multilingual tokenizer with a 200k vocabulary. Choose this when your target system specifies o200k_base.

Which encoding should I choose?

Check the tokenizer or encoding name in your target system’s documentation, then select that exact name above. A vocabulary size is not a context-window limit. If you are unsure, compare encodings; the count applies only to the selected tokenizer.

Text to tokenize
Tip: drop a file here20 chars · 32 bytes · 1 line

Estimated text-token cost (USD)

Total input includes any cached portion. Output tokens are your planned or measured generation. Rates are per 1 million tokens and remain editable.

Count the input text to calculate an estimate.

Counts text with the selected encoding. Chat framing, hidden instructions, tools, images and audio are excluded. This is not a guaranteed bill. Cost estimates exclude chat framing, hidden reasoning, tools, images, audio, taxes and provider-specific fees; caching is only included when you supply cached token counts.

Choose an encoding

Available BPE encodings are o200k_base, cl100k_base, p50k_base and r50k_base. Token counts can differ between encodings, especially for non-English text, source code and punctuation. Choose the encoding required by your target system.

Compare a text budget

Enter Hello, world! exactly, including its punctuation and space, then select an encoding. This table is generated with the same tokenizer package used by the counter:

EncodingToken countToken IDs
o200k_base413225, 11, 2375, 0
cl100k_base49906, 11, 1917, 0
p50k_base415496, 11, 995, 0
r50k_base415496, 11, 995, 0

Equal counts can still contain different IDs. Try your own source code, emoji or non-English text rather than assuming one token always means one word. A vocabulary may split a character across multiple tokens; only the complete sequence is guaranteed to decode as the original text.

Set a context budget to see the percentage used by the text. Reserve additional space for instructions, chat structure, tool definitions and generated output. A budget is a planning aid rather than a guarantee that a complete API request will fit.

Estimate model cost

Cost presets for standard text-token pricing were checked on 2026-10-25. Every rate is editable. The estimator uses decimal arithmetic for input, cached input, output and request multipliers. It does not include hidden reasoning, tool fees, multimodal charges, taxes or chat framing and cannot guarantee a final API bill.

For example, one million input tokens with 250,000 cached, 100,000 expected output tokens and two identical requests cost $4.85 at input $2, cached input $0.50 and output $8 per million tokens. Caching discounts are applied only to the cached subset you specify.

Local processing and limits

The selected vocabulary loads on demand from this site. Counting runs in a cancellable worker with a thirty-second timeout and a five-hundred-thousand-character input limit. No text is sent to a tokenizer API.

For ordinary character and word totals use Word Counter. Before sharing a log or prompt sample, review it with Sensitive Data Redactor. Neither character counts nor a successful token count proves that a complete request fits a particular service’s context limit.

Powered by open-source software. Third-party licenses.

Documentation examples checked: . How these tools are checked.

Frequently asked questions

How do I estimate model costs?

Choose a supported model preset or enter custom USD rates per million tokens. Count input text, enter expected output tokens, cached input tokens and request count. The cached count is a subset of total input, not extra input. Prices remain editable and can differ by service tier, contract or provider changes.

Does this count Claude tokens locally?

No. The Claude profile uses manual counts from a matching provider tokenizer or usage report, with rates you enter. It does not substitute a GPT encoding for Claude or send your prompt to a provider. Other models without a verified bundled tokenizer can use the same manual-count mode.

Is this an exact API bill estimate?

No. This counts the supplied text with the selected encoding. Chat framing, hidden instructions, tool definitions, images, audio and other server-side content are excluded.

Why does a token show a replacement character?

Some tokens contain only part of a UTF-8 character. Decoding a single token in isolation can show the replacement character even though the complete token sequence decodes correctly.

Are all token IDs shown?

The count covers the entire input. To keep the browser responsive, the boundary visualization and token ID export show at most the first five hundred tokens.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.