How the online tokenizer works
Paste text into the editor to see its token count, colored segments and numeric IDs. Each visual segment connects a readable piece of the input to the IDs needed to represent it. Hover over a segment or an ID to highlight the matching part, then enable Show whitespace when you need to inspect spaces or line breaks.
The default o200k_base selection analyzes plain text without adding a chat wrapper. Switch to cl100k_base to compare another raw vocabulary. For example, Hello world! 你好,世界! produces 8 tokens with o200k_base and 11 with cl100k_base. Keep the sample unchanged to see how the tokenizer, rather than an edit, changes the result.
Online tokenizer vs word counter
An online tokenizer shows the units used by a selected encoding; a word counter counts words according to its own text rules. One visual word may become several token IDs, and punctuation or spacing can also affect the split. This makes token inspection useful for debugging prompts that appear short but take more input space than expected.
Try a sentence, a code snippet and a JSON object separately. Compare their token totals and inspect the separators around numbers, quotes and newlines. The exercise shows why character length and word length are useful descriptions of a document but cannot guarantee its token length under every model vocabulary.
Online token count by encoding and model
Raw encodings provide reproducible tokenization for the text entered. Model presets may use a compatible base encoding or a published model tokenizer, and their request formatting can have a different scope. Use the support note and model directory to select the counting method that matches your purpose.
When exporting IDs into your own script, record which encoding produced them. Token IDs are vocabulary-specific, so an ID list alone is not a portable text format. If your goal is a complete API input count, include the same messages, tools and other supported inputs in the provider's counting workflow.
| Selection | What is counted | Accuracy boundary |
|---|---|---|
| o200k_base | Raw text in the selected vocabulary | Exact raw encoding; no complete request wrapper |
| cl100k_base | Raw text in a different vocabulary | Exact raw encoding; choose it deliberately |
| GPT-5.6 compatible view | Text under the compatible o200k_base view | Check complete request usage with OpenAI |