OPENAI TOKEN COUNTER
Count OpenAI tokens
Paste one item per line
Each non-empty line is counted separately. Line breaks inside one item are not preserved in batch mode.
Batch result
| Item | Text preview | Characters | Tokens |
|---|---|---|---|
| Paste text and count to see results. | |||
Tokenizer loads when you count. Your text stays in this browser.
SCOPE
What this OpenAI token counter measures
The tool applies the selected OpenAI byte-pair encoding to each line and reports its text-token count. Modern OpenAI text models commonly use o200k_base; older model families commonly use cl100k_base. Choose the encoding that matches the model you plan to call.
What is not included
A plain-text count does not include API message wrappers, roles, tools, schemas, images, files, hidden instructions, output tokens, cached tokens, or reasoning tokens. For a complete request, use the token usage returned by the API or OpenAI’s input-token counting endpoint.
How batch mode works
Every non-empty line becomes one independent item. The table shows the character count and encoded token count for each item, followed by a combined total. Copy results produces tab-separated text that can be pasted into a spreadsheet without uploading the prompts.
Privacy and tokenizer source
Counting runs locally in your browser with the open-source gpt-tokenizer implementation. The tokenizer module is downloaded from a public package CDN, but the text you enter is not sent with that request or submitted to Token Cost Kit.
FAQ
OpenAI token counter questions
Is this OpenAI token count exact?
It is exact for the pasted text under the encoding you select. A full API request can contain additional formatting and non-text inputs that are outside this page’s scope.
Which encoding should I select?
Use o200k_base for modern OpenAI text-model families and cl100k_base for older families. Confirm the encoding against the documentation for your exact model.
Can I count several prompts at once?
Yes. Put each prompt on its own line. Empty lines are ignored, and every remaining line receives an independent result.
Does the counter upload my prompts?
No. Tokenization and result generation happen inside the current browser tab.