AI Token Counter
Count prompt tokens with the bundled o200k_base tokenizer. Compare with your token budget as you type, and inspect the token IDs on your device.
- Free
- Works Offline
- No Uploads
Count Tokens in a Prompt
- Open the HTML, review Security Check, then select Continue.
- Paste text, open a UTF-8 TXT file, or select Open Sample. The count updates as you edit.
- Select o200k_base and enter an optional whole-number token budget. Text stays in the editor when you switch tokenizer.
- Open Token IDs to review the sequence or download it as a JSON array.
- Imported TXT line breaks are measured as read. Editing uses LF. The tokenizer treats special-token markers as ordinary text.
Measure Text and Compare a Budget
- Paste text, open a UTF-8 TXT file, or try the sample. The local AI token counter updates as you edit.
- Use the bundled o200k_base tokenizer and enter an optional token budget.
- Open Token IDs to inspect or download the exact sequence in source order.
Formats and Compatibility
| Input | Pasted text or one UTF-8 TXT file up to 128 KiB. Files retain their original line breaks until you edit. A leading UTF-8 file signature is skipped. Runs of whitespace or unbroken text may use up to 4 KiB. |
|---|---|
| Output | An exact o200k_base plain-text token count, Unicode character count, UTF-8 byte count, budget difference, and optional token IDs as JSON. |
| Browser | A modern browser with local file support. |
| Scope | Pasted or UTF-8 TXT text up to 128 KiB, with runs of up to 4 KiB of whitespace or unbroken text. Exact ordinary-text tokenization for the bundled o200k_base encoding. |
| Operating Systems |
Local Processing Without Uploads
Use this AI token counter without uploading. The browser-based tool counts locally with no upload, account, or API call.
Select Open Sample to see the workflow with the included example.
Formats and Compatibility
Plain UTF-8 text. The offline standalone embeds WebAssembly and a pinned o200k_base vocabulary. Pasted or edited text uses browser LF line breaks.
Check the Count Against Your Budget
Enter a maximum token count to see what remains or how far the text goes over. Review all token IDs in source order. The count covers plain text only.
Frequently Asked Questions
How do I use the AI token counter offline?
Extract the Tool ZIP and open AITokenCounter.html. The tokenizer and its vocabulary are included.
Where is the AI token counter download?
Select Download Tool ZIP and open the HTML inside the extracted folder.
Is this a free AI token counter?
Yes. Both the workbench and the standalone download are free.
How do I use the AI token counter in browser mode?
Paste or open plain text, check the live count and enter a budget if you have one. The bundled encoding is o200k_base.
Can I use this as an LLM token estimator?
It counts ordinary text exactly for the bundled o200k_base encoding. For a different tokenizer, use that tokenizer. Message wrappers and billing are outside this tool’s scope.
What happens when I select an unavailable tokenizer?
The tool leaves the source intact and shows that a token count is unavailable for that tokenizer.
What does the character count measure?
Each Unicode code point counts once. A visible character such as a joined emoji can contain several code points.
Does this tool work offline on Windows, macOS, Linux, and ChromeOS?
Yes. Local Studio tools run offline on Windows, macOS, Linux, and ChromeOS. Download the tool ZIP, extract it, and open the included HTML file in a supported browser. Your files are processed on your device without uploads.
Which browsers can I use with this offline tool?
Use a current version of Google Chrome, Microsoft Edge, Mozilla Firefox, or Safari where that browser is available for your operating system. Chrome is built into ChromeOS, and Safari is available on macOS.