webdev.pro

Token Counter

Count tokens for GPT, Claude, Gemini, Llama, Mistral, and other models.

Tokenization runs entirely in your browser. Your text is never uploaded.

exact
Input
Estimated cost Pricing updated: 2026-05-10
Input
Output (estimated)
Total
How accurate is this?

Exact tokenizers — for OpenAI we run js-tiktoken locally with the right encoding (o200k_base for the GPT-5.x family, cl100k_base for older models). For DeepSeek and Qwen we load the official Hugging Face tokenizer.json files on demand via @huggingface/transformers — the bundle is code-split so it only downloads when you first select one of those models.

Estimates — for Anthropic, Google, and xAI we use OpenAI's cl100k_base as a proxy because those providers don't publish their tokenizers. Meta and Mistral do publish theirs, but the canonical Hugging Face repos are license-gated and unreachable from a browser without auth, so we use the same cl100k_base proxy for them. Counts are typically within ~10–20% of the real tokenization, but treat them as approximations — especially for capacity planning or billing.

Note on Claude Opus 4.7 — Anthropic shipped a new tokenizer with Opus 4.7 that produces up to ~35% more tokens for the same input than older Claude models. Our cl100k_base proxy will under-count for that model in particular.

Tokenizers can change between model versions and even between minor revisions. If a number matters for production decisions, verify with the provider's own counting endpoint.

Pricing reflects public list pricing as of 2026-05-10 and may not include volume discounts, batch pricing, or context-cache rates. Check the provider's pricing page before relying on these numbers.

Related tools