OpenAI Token Counter
Count OpenAI plain-text tokens with o200k_base or cl100k_base tokenization.
What it does
This token counter counts plain text with OpenAI tokenizer encodings. Use o200k_base for modern OpenAI models and cl100k_base when you need older GPT-4 or GPT-3.5-era tokenization.
Tokens are not the same as words or characters. A short English word may be one token, punctuation can split into separate tokens, and non-English text can tokenize very differently across encodings.
Common uses
- Estimate the size of pasted prompt text before sending it to an OpenAI model.
- Compare o200k_base and cl100k_base counts when moving prompts between newer and older OpenAI model families.
- Check rough context-window usage for drafts, snippets, instructions, and documentation text.
Watch outs
- This counts plain text only. Full API request payloads can include extra tokens for messages, tools, schemas, files, images, or model-specific behavior.
- Claude, Gemini, and other providers use different tokenizers. Their exact counts need provider-specific token counting APIs or tokenizers.
- Special-token-looking strings are counted as literal pasted text in this tool, not as control tokens.
Privacy
Text is tokenized in your browser. Nothing you type or paste is sent to Crypto Lambda.
FAQ
Is this token count universal for every LLM?
No. This tool uses OpenAI tokenizer encodings for plain text. Claude, Gemini, and other model families can split the same text into different token counts.
Which encoding should I choose?
Use o200k_base for modern OpenAI models. Use cl100k_base when matching older GPT-4, GPT-3.5, or third-generation OpenAI embedding workflows.
Why can API token usage differ from this count?
API requests can include message wrappers, tools, schemas, files, images, caching, reasoning, or provider-specific overhead that a plain-text tokenizer does not see.
Can this count Claude or Gemini tokens?
Not exactly. Claude and Gemini provide their own token counting APIs for accurate request-level counts, and those counts may differ from OpenAI tokenization.
Related tools
Word Counter
Count words, characters, and top word frequencies in browser-side text using Intl.Segmenter for language-aware boundaries.
Hash Text
Hash pasted text into common digests including MD5, SHA-1, SHA-256, SHA-384, and SHA-512 without uploading the input.
Base64
Convert text to Base64, decode Base64 back to UTF-8, and switch to Base64URL for tokens, JWT segments, and URL-safe payloads.