o200k_base
exact— tokens
GPT-5.5, GPT-5.4, GPT-4.1, GPT-4o, o3, o4-mini
Count tokens with OpenAI's o200k_base and cl100k_base and DeepSeek's official tokenizer in your browser. See every token and cost for GPT, Claude and Gemini.
Scan with WeChat to share this tool
| Card | Models | Why it is exact |
|---|---|---|
| o200k_base | GPT-5.x, GPT-4.1, GPT-4o, o1, o3, o4-mini | OpenAI’s tiktoken model table maps these names to o200k_base |
| cl100k_base | GPT-4, GPT-3.5 Turbo, text-embedding-3 | Same table; the embeddings guide names cl100k_base for text-embedding-3 |
| DeepSeek V4 | deepseek-flash, deepseek-v4-pro | Built from the tokenizer.json in DeepSeek’s offline token counting package |
| ≈ reference | Claude, Gemini, GPT-6 | No local tokenizer is published; the row uses the o200k_base count |
For Claude, Anthropic’s token counting endpoint is free and says its result is itself an estimate. It also says Claude 4.7 and later produce about 30% more tokens than earlier Claude models for the same text. For Gemini, Google’s token guide only offers “about 4 characters” per token and points to countTokens. OpenAI’s tiktoken has no entry for GPT-6, so this page does not claim one.
The sample prompt (the Sample button) is a 486-character code review request:
o200k_base gives 104 tokens, cl100k_base 104 and DeepSeek V4 105. With 1,000 output tokens, one request costs $0.03052 on gpt-5.5 and $0.001232 on deepseek-flash at peak rates (half that off-peak). For English the three tokenizers land within a few tokens of each other.
The gap opens with other scripts. The same one-line instruction in four languages:
| Text | Characters | o200k_base | cl100k_base | DeepSeek V4 |
|---|---|---|---|---|
| English: “Summarize the meeting notes below in three lines and list the decisions and action items.” | 89 | 18 | 18 | 17 |
| Chinese: 请用三句话总结下面这份周报,并列出风险项。 | 21 | 16 | 23 | 15 |
The Chinese line costs 44% more tokens on GPT-4 (cl100k_base) than on GPT-4o (o200k_base), because the larger vocabulary holds many more Chinese words. Some characters are not in cl100k_base at all: 🦜 becomes byte tokens, which the token view shows in hex inside ⟨⟩ boxes.
Costs use the standard per-million-token prices checked on 2026-10-01, without batch or cache discounts. Where a provider charges more for long prompts, the table switches rate: gpt-5.5 and GPT-6 above 272,000 input tokens, gemini-3.1-pro-preview above 200,000. DeepSeek rows also show the off-peak price, which DeepSeek sets at half the peak price. The context column divides the count by each model’s input limit and marks rows over it.
Tested on 2026-10-01 with the Chinese sentence “你是一名资深后端工程师,正在评审一个合并请求:在 PostgreSQL 分析库前面加一层 Redis 读穿缓存。” (o200k_base 35 tokens, DeepSeek V4 26):
This page also fixes two problems of the common JavaScript port, js-tiktoken, which it used before. js-tiktoken reads \s with JavaScript’s rules, so text containing a byte-order mark (U+FEFF) or U+0085 can split differently from tiktoken. And its merge step slows down sharply on long runs without spaces: 20,000 Chinese characters in a row took over three minutes. Here the regex uses Unicode White_Space and the merge uses a priority queue, so the same input takes milliseconds.
<|endoftext|> count as ordinary text for OpenAI (7 tokens), the same as tiktoken’s encode_ordinary; the page never throws on them, which the old version did. DeepSeek’s tokenizer.json recognises its own markers such as <|User|> as one token, and so does this page.Related: check plain word and character counts with the Word & Character Counter, remove API keys from a prompt with Redact API Keys & Secrets, and convert batch request files with the JSONL Converter.
o200k_base, cl100k_base and DeepSeek V4. The tool runs the same vocabularies and merge rules as OpenAI's tiktoken and DeepSeek's official tokenizer.json, and its test suite compares the token ids with those reference implementations on more than 1,500 strings. Claude, Gemini and GPT-6 have no tokenizer published for local use, so those rows show the o200k_base count marked with ≈ as a reference only.
The tool counts one piece of plain text. An API request also contains message roles and separators, the system prompt, tool definitions, images and files. OpenAI says its input token count endpoint includes these formatting tokens, which local tokenizers do not see. Paste only the text you want to measure, or call the provider's counting endpoint with the full request.
No. Counting runs in a Web Worker in your browser. Tokenizer vocabularies are static files on this site, loaded on demand. After a task is terminated, the next count may load those files again. Requests contain no input text. You can confirm this in the Network tab of the browser's developer tools.
Files up to 20 MB open with the Open file button, and pasted text has no fixed limit. Character statistics, pre-tokenization and token counting run in a Web Worker. Editing or clearing the input terminates the previous calculation. Only counts, statistics and the first 2,000 token labels return to the page. Large text can still take time to display in the input field. In our test (Apple M1 Max, Chromium 152, 2026-10-03), one million characters of mixed Chinese and English took 1 to 2 seconds to show in the input field and about 1.1 to 1.9 seconds more to count with o200k_base.
They were checked on 2026-10-01 against the official pricing pages of OpenAI, Anthropic, Google and DeepSeek, and the date is printed under the table. Providers change prices and add tiers without notice, so check the linked page before you commit a budget.