What is a token counter (LLM token counter)?
A token counter splits text into tokens with a language model's own tokenizer and counts them, so you can estimate API cost and context length. Here, paste text into the box (or open a text file): the table shows the token count for DeepSeek, both Qwen generations, GPT-5 / GPT-4o and GPT-4 at once, and “How the text is split” marks every token; enter a price to estimate the input cost. No sign-up needed.
How many tokens is one Chinese character? Is DeepSeek's 0.6 right?
Measured on this site's Chinese prose, DeepSeek uses about 0.77–0.79 tokens per Han character, or about 0.62 per character when punctuation and spaces count as characters. DeepSeek's own documentation says “1 Chinese character ≈ 0.6 token”, which matches the second way of counting. Common words merge into one token; rare characters split into two (for example 龘). Figures for the other models are in the quick reference above.
The API reports a different number. Is the count wrong?
The tool counts the text itself and matches the official tokenizers id by id. An API's prompt_tokens also includes the role markers and separators the chat template adds to each message: in Qwen's documented example, 你好 is 1 token on its own and is billed as 11. System prompts, tool definitions and earlier messages count too. A constant difference is your template overhead — use it to calibrate future estimates.
Which vocabulary do DeepSeek V4, R1, Qwen3.6 and GPT-5 use?
DeepSeek's base vocabulary is identical from V3, R1, V3.1 and V3.2 through V4 and V4.1; only the special tokens differ. Qwen has two generations: Qwen3.5, 3.6 and 3.8 use the new 248K vocabulary, Qwen3, Qwen2.5 and QwQ the 151K one (these are the vocabularies of the open weights; Alibaba Cloud's documentation does not say which one its hosted Model Studio models use). For OpenAI, following tiktoken's model map: GPT-5, GPT-4.1, GPT-4o, o1, o3 and o4-mini use o200k_base; GPT-4, GPT-3.5 Turbo and text-embedding-3 use cl100k_base.
Why does GPT-4 need so many more tokens than GPT-4o for Chinese?
GPT-4's cl100k_base has about 100,000 entries with few Chinese ones, so many characters take two or three byte-level tokens; GPT-4o's o200k_base has about 200,000 entries and many Chinese words. This page's “Chinese” example is 156 tokens in GPT-4 and 111 in GPT-4o.
Why do numbers cost so many tokens in Qwen?
Qwen's pre-tokenizer puts every digit in its own chunk, so 1234567 is 7 tokens; DeepSeek and GPT group digits in threes and need 3. Number-heavy text such as tables, invoices and logs counts noticeably higher in Qwen.
Is my text uploaded?
It is not sent to our servers. Tokenizing runs in a background thread in your browser; the only files the tool downloads are the vocabularies, from this site, on first use.
Do line breaks change the token count?
Yes, most of all in DeepSeek: it splits a Windows line break \r\n into two tokens, so the same code with CRLF line endings costs about 15% more, against under 0.5% in the other vocabularies. A browser text box turns pasted line breaks into \n, so pasted text is counted with LF; files loaded with Open file keep their original line breaks and BOM.
How are markers like <|im_start|> or <think> counted?
As ordinary text, split into several tokens — the same as tiktoken's encode_ordinary — and the page tells you when your text contains them. If you host an open model yourself, the inference server usually reads each one as a single special token, so its count will be lower.
How are a reasoning model's thinking tokens counted?
Thinking is generated by the model, so it cannot be known before the call; this tool counts text you already have. Qwen's documentation states that thinking is billed as output tokens; check each vendor's documentation for other reasoning models. Thinking is often longer than the final answer, so budget for it separately.
How long can the text be?
There is no hard limit; browser memory is the bound. In our test, 200,000 Chinese characters were counted in under a second once the vocabularies were loaded. For very long text the split view shows the first 2,000 tokens, while the counts always cover everything. Opened files can be up to 20 MB.
Can tiktoken count DeepSeek or Qwen tokens?
No. tiktoken only ships OpenAI's vocabularies (o200k_base, cl100k_base); used for DeepSeek or Qwen it is off by about a factor of two on Chinese (this page's “Chinese” example: 156 with cl100k_base, 75 in DeepSeek). For DeepSeek and Qwen, load the official tokenizer with Hugging Face transformers and pass add_special_tokens=False to match this tool's plain-text count; DeepSeek's API documentation also offers an offline tokenizer package on its token usage page.