Token Counter

Exact OpenAI tiktoken counts (o200k & cl100k) plus Claude, Gemini, and DeepSeek estimates. Free, private, browser-local.

Privacy: Text never leaves your browser. OpenAI counts use a local tiktoken port — no API key.

0 chars0 non-space0 words0 linesLoading tokenizer…

OpenAI o200k (exact)

0

tokens

Estimate $ cost →
TokenizerTokensAccuracyNotes

How to Use

  1. 1Paste the prompt or document you plan to send to a model.
  2. 2Use o200k for modern OpenAI models; cl100k for GPT-4 / 3.5.
  3. 3Treat Claude / Gemini / DeepSeek rows as planning estimates.
  4. 4Jump to the LLM Cost Calculator to turn tokens into monthly $.

Why counts differ

Code & URLs

Often more tokens than plain prose

Punctuation and paths split into many BPE pieces.

CJK / emoji

Higher tokens per visible character

Character heuristics undercount; tiktoken stays exact for OpenAI.

Tips

  • System + tools + history all count toward the context window — not just the user message.
  • For Claude billing-critical work, confirm with Anthropic’s count_tokens API.
  • Shorter prompts usually beat “clever” compression that models ignore.
  • Pair this with the cost calculator when comparing model tiers.

Frequently Asked Questions

How accurate is this token counter?

OpenAI rows use gpt-tokenizer (a pure-JS port of tiktoken) with o200k_base and cl100k_base — those counts match OpenAI’s tokenizer. Claude, Gemini, and DeepSeek rows are labeled estimates because those vendors don’t publish a browser tokenizer.

What is o200k_base vs cl100k_base?

o200k_base is used by GPT-4o, GPT-5.x, and o-series models. cl100k_base is used by GPT-4 and GPT-3.5. The same English text can produce slightly different counts under each encoding.

Does my text leave the browser?

No. Tokenization runs entirely client-side. Nothing is uploaded.

Can I use this for billing?

Use exact OpenAI counts for OpenAI prompts. For Anthropic/Google, verify with their official count APIs before locking budgets. Pair with our LLM Cost Calculator for dollar estimates.

Why show a token preview?

Seeing how text splits into pieces helps debug weird counts (URLs, code, CJK, emoji) and teaches how BPE tokenizers work.

Is the token counter free?

Yes. No signup and no API key required.