Prompt Tokenizer
Count and inspect the tokens a prompt uses with the GPT-4o o200k_base tokenizer.
Runs on your device. Nothing you add is uploaded.
The first run loads a 9.7 MB tokenizer dictionary from piko.tools.
Your result shows here after you press “Count tokens · first download 9.7 MB”. Nothing leaves your device.
How to use Prompt Tokenizer
- Paste a prompt or use the example.
- Load the tokenizer and count the tokens.
- Inspect the token IDs and text fragments.
Questions
This tool uses the o200k_base tokenizer associated with GPT-4o. Other tokenizers can split the same prompt differently.
It counts the text you entered. Chat wrappers, system messages, and tool definitions can add more tokens.
Many tokens include spaces or newlines. The table displays fragments as quoted strings so you can see where whitespace belongs.
How this works
Transformers.js reads Xenova/gpt-4o’s o200k_base tokenizer (MIT, 9.7 MB) in a Web Worker. The vocabulary is served by piko.tools. No generative model or GPU is needed.
Everything happens in this browser tab. What you type or add stays on your device, and the page has no tracking. Your last settings are kept in this browser so the tool opens the way you left it. Privacy
Related tools
More in On-device AIGrammar CheckerFind grammar, spelling, and punctuation issues in English and apply suggested fixes on your device.Text SummarizerTurn an English passage into key points or a short paragraph with your browser’s on-device model.Language DetectorIdentify the likely language of a passage using desktop Chrome or Edge’s on-device detector.Translate Text on Your DeviceTranslate text on your device with desktop Chrome or Edge when its built-in translator is available.Spell CheckerSpot English spelling mistakes and apply suggested corrections in your browser.Image Upscaler (AI)Use Swin2SR to enlarge a local image by 2× or 4× and compare the result.