Skip to content

Token Counter for DeepSeek, Qwen and GPT

Exact token counts for DeepSeek, Qwen and GPT from each vendor's own tokenizer, not a character estimate. Paste text to compare five vocabularies side by side and see where every token splits. Free, runs in your browser.

Runs in Browser Free
Tokenized in your browser with each vendor's own vocabulary — your text is not sent to our servers.
Examples:

Characters
0
Han characters
0
UTF-8 bytes
0
Model Tokens Tokens per character
DeepSeek V4 / V3 / R1 DeepSeek · 128K —
Qwen3.5 / 3.6 / 3.8 Qwen · 248K —
Qwen3 / Qwen2.5 / QwQ Qwen · 151K —
GPT-5 / GPT-4.1 / GPT-4o / o3 o200k_base —
GPT-4 / GPT-3.5 Turbo cl100k_base —

These are the tokens of the text itself. An API call also counts the chat template around each message, so its reported prompt_tokens is usually a few higher.

How the text is split

Type or paste text to see every token.

Enter the input price from your provider's pricing page. Prices change, so the tool does not hard-code them.

The output of all five vocabularies was compared id by id with Hugging Face tokenizers 0.23.3 and OpenAI tiktoken 0.14.0 on 26,714 test texts (3.88 million characters) plus a set of Unicode version-boundary characters, and matched; every example number on this page was checked against the same reference implementations. The per-character ratios come from measurements on this site's own text (29,500 Han characters of blog prose and 52,500 of tool documentation). The model-to-vocabulary mapping comes from tiktoken's model map and a file-by-file comparison of the vendors' official repositories, checked in November 2026. — Go Tools Engineering Team · Nov 8, 2026

Built and verified by the Go Tools Engineering Team.

Token conversion quick reference

How many characters is one token?

About 4 characters of English per token It depends on the vocabulary and the language. Measured on this site's own text (about 82,000 Han characters of Chinese): English runs about 4.3–4.4 characters per token, or about 1.4 tokens per word; in Chinese prose a Han character costs about 0.8 tokens in DeepSeek and Qwen3.5, 0.9 in Qwen3, 1.0 in GPT-4o and 1.3 in GPT-4.

How many tokens are 10,000 Chinese characters?

About 6,300 in DeepSeek, 10,000 in GPT-4 Counting punctuation as characters, measured on this site's Chinese prose: about 6,200–6,300 in DeepSeek, 6,400–6,500 in Qwen3.5, 7,000–7,200 in Qwen3, 7,700 in GPT-4o and 10,300–10,500 in GPT-4. Code and number-heavy text take more.

Why does Chinese use more tokens than English?

Same passage: 59–60 tokens in English, 71–156 in Chinese This page's “Chinese” and “English” examples are the same passage. The English version is 59–60 tokens in all five vocabularies; the Chinese one is 71 in Qwen3.5, 75 in DeepSeek, 84 in Qwen3, 111 in GPT-4o and 156 in GPT-4 — 18% to 160% more. English varies little between vocabularies (about 1.4 tokens per word on this site's text); for Chinese it depends on how many Chinese entries the vocabulary has, and one with few (GPT-4's cl100k_base) splits many characters into 2–3 byte-level tokens.

What unit is a token?

The smallest unit a model splits and bills text in A token is the smallest unit a language model splits text into, and the unit for API billing and context windows. It can be a word, part of a word, a character, a phrase or a few bytes of one character — each model's vocabulary decides.

Can it count tokens for Claude, Gemini or Doubao?

No public tokenizer — only official counting APIs Not exactly. Claude has had no public tokenizer since Claude 3; Anthropic offers a count_tokens API instead (its documentation adds that Claude 4.7 and later use a newer tokenizer that produces about 30% more tokens for the same text). Gemini and Doubao are likewise counted through their official APIs, and Doubao also has an official token calculator in the Volcano Engine Ark console (sign-in required). This tool lists only models whose official vocabulary is public and matches id by id.

What is a token?

A token is the unit a language model reads and writes, and the unit APIs bill and context windows are measured in. A model never sees letters or Chinese characters directly: its tokenizer first cuts the text into pieces found in its vocabulary and turns each piece into an integer id. Common words and phrases have their own entries and take one token; anything missing falls back to UTF-8 bytes, so a single Chinese character can cost two or three tokens. The count therefore depends on the vocabulary. DeepSeek and Qwen store 人工智能 (artificial intelligence) as a single token and GPT-4o splits it in two, while GPT-4's cl100k_base has few Chinese entries and needs 12 tokens for the sentence below — more than twice DeepSeek's 5. Below is this tool's actual split.

文本:人工智能正在改变世界。(11 个字符)

DeepSeek V4        5  [人工智能][正在][改变][世界][。]
Qwen3.5 / 3.6      5  [人工智能][正在][改变][世界][。]
Qwen3 / 2.5        5  [人工智能][正在][改变][世界][。]
GPT-5 / GPT-4o     6  [人工][智能][正在][改变][世界][。]
GPT-4             12  [人][工][智×2][能][正在][改][变][世×2][界][。]

×2 表示这个字被拆成了 2 个字节级 token

What this token counter does

Both Qwen vocabularies, counted exactly

Qwen3.5, 3.6 and 3.8 switched to a new 248K vocabulary with different splitting rules; Qwen3, Qwen2.5 and QwQ keep the 151K one. Both come from the tokenizer.json in the official open weights and are counted separately — never approximated with a GPT tokenizer.

Official vocabularies, checked id by id

DeepSeek uses its official vocabulary (identical from V3 to V4.1); GPT uses OpenAI's o200k_base and cl100k_base. We compared 26,714 test texts (3.88 million characters across 15 languages, code, whitespace and characters at Unicode version boundaries) id by id against Hugging Face tokenizers and OpenAI tiktoken: all five vocabularies match.

Five models side by side

One paste gives five counts, so you see at once which model handles your text with the fewest tokens. The tokens-per-character column compares texts of different lengths fairly.

Every token visible

The split view colors each token and can show its id. When several byte-level tokens only make whole characters together, they are grouped in one dashed block instead of showing garbled bytes; invisible characters such as zero-width spaces are written out by code point, e.g. ⟨U+200B⟩.

Files counted as they are

Opened files keep their original CRLF line breaks and BOM. DeepSeek splits a Windows line break \r\n into two tokens, so the same code with CRLF line endings costs about 15% more. Text pasted into the box is counted with the LF line breaks the browser keeps.

Runs in your browser

Tokenizing happens in a background thread (Web Worker); your text is not sent to our servers. Once the vocabularies are loaded, 200,000 Chinese characters are counted in under a second, and the text box stays responsive.

Counting tokens in code

tiktoken (Python)

len(tiktoken.get_encoding("o200k_base").encode_ordinary(text))

OpenAI's official library, OpenAI vocabularies only. The most direct way to count GPT-5 and GPT-4o input tokens; it cannot count DeepSeek or Qwen.

transformers AutoTokenizer

AutoTokenizer.from_pretrained("Qwen/Qwen3.6-35B-A3B").encode(text, add_special_tokens=False)

Loads the official tokenizers of open models such as DeepSeek and Qwen. The first run downloads the vocabulary files from Hugging Face.

DeepSeek's offline tokenizer

DeepSeek API documentation, token usage page

The official offline tokenizer, used with transformers. Its vocabulary is the same as this tool's DeepSeek row.

Official counting APIs

Anthropic messages/count_tokens, Gemini countTokens, OpenAI responses/input_tokens

The only way for models without a public tokenizer, and the result includes chat-format overhead. It needs a request and an API key, and the text goes to the vendor.

This token counter

Paste and read five counts

No code and no dependencies — handy for checking one prompt or comparing models. For batch jobs, use the libraries above.

Token counting examples: one text, five splits

One Chinese passage, twice the tokens in one model

Click the “Chinese” example on this page: a 117-character everyday passage (106 Han characters)
DeepSeek V4        75
Qwen3.5 / 3.6      71
Qwen3 / 2.5        84
GPT-5 / GPT-4o    111
GPT-4             156

Per Han character: Qwen3.5 about 0.67, DeepSeek 0.71, Qwen3 0.79, GPT-4o 1.05 and GPT-4 1.47 tokens. Click “English” for the same passage in English: all five land between 59 and 60.

Numbers: Qwen spends one token per digit

订单金额 12345.67 元,共 2026 件
DeepSeek V4   16   …[123][45][.][67]…[202][6]…
Qwen3.5       22   …[1][2][3][4][5][.][6][7]…[2][0][2][6]…
Qwen3         22   (digits split the same way)
GPT-4o        13   …[123][45][.][67][ 元][,共]…
GPT-4         16   …[123][45][.][67]…

Both Qwen generations split every digit on its own, while DeepSeek and GPT group digits in threes. Number-heavy text — tables, invoices, logs — costs noticeably more in Qwen.

Invisible zero-width spaces

你​好​世​界 (three U+200B zero-width spaces between the characters)
Without them: DeepSeek 2 · Qwen3.5 2 · Qwen3 2 · GPT-4o 2 · GPT-4 5
With them:    DeepSeek 7 · Qwen3.5 7 · Qwen3 7 · GPT-4o 7 · GPT-4 8

The zero-width spaces break 你好 and 世界 apart, so each character becomes its own token and each zero-width space takes one more. Text copied from the web often contains them; the split view shows them as ⟨U+200B⟩.

Emoji: the newer vocabulary costs more

👍🎉
DeepSeek V4   3
Qwen3.5       6
Qwen3         2
GPT-4o        3
GPT-4         6

Qwen3's older vocabulary stores both emoji whole; the new 248K vocabulary drops them back to UTF-8 bytes, so a 4-byte emoji takes 3 tokens. A newer vocabulary is not cheaper everywhere — count your real text.

How to use the token counter

  1. 1

    Paste your text

    Paste a prompt, a document or some code, or use Open file to load a .txt, .md, .json, .csv or other text file. No text at hand? Click one of the examples. The first count downloads five vocabularies from this site (0.4–2.2 MB each, gzipped); they are not downloaded again while the page stays open.

  2. 2

    Read the five counts

    The table shows the token count for DeepSeek, Qwen3.5/3.6/3.8, Qwen3/Qwen2.5, GPT-5/GPT-4o and GPT-4/GPT-3.5 at once, plus the average tokens per character. Above it you get characters, Han characters and UTF-8 bytes, to compare with character-based estimates.

  3. 3

    Inspect the split

    Each colored block under “How the text is split” is one token. A dashed outline means several byte-level tokens only make whole characters together. Turn on “Show token IDs” to compare with the ids an API or tiktoken returns. Click any table row to switch models.

  4. 4

    Estimate the cost

    Enter the selected model's input price per million tokens to get the cost of this text as input. The tool ships no price list — vendors change prices often and split them by peak hours and cache hits, so use the number on their pricing page today.

Common token counting mistakes

Estimating tokens as characters × a constant

A constant only holds for one kind of text. The same 24 characters 订单金额 12345.67 元,共 2026 件 are 13 tokens in GPT-4o and 22 in Qwen — the more digits, the bigger the gap.

✗ Wrong
tokens ≈ characters × 0.6
✓ Correct
Split with the target model's vocabulary and count

Using a GPT tokenizer for DeepSeek or Qwen

tiktoken only ships OpenAI vocabularies. This page's “Chinese” example counts 156 tokens with cl100k_base, where DeepSeek uses 75 — an estimate twice too high.

✗ Wrong
tiktoken.get_encoding("cl100k_base")  # used for DeepSeek
✓ Correct
AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V4.1-Flash")

Treating the text count as the bill

The bill also includes the chat template, the system prompt, the output and a reasoning model's thinking; some services also price cache hits differently. Estimating from the input text alone comes out low.

✗ Wrong
cost = prompt tokens × input price
✓ Correct
cost = prompt_tokens × input price + completion_tokens × output price

Invisible characters in the text

Zero-width spaces (U+200B) break words apart: 你好世界 is 2 tokens in DeepSeek and 7 once three zero-width spaces sit between the characters.

✗ Wrong
你\u200b好\u200b世\u200b界   → 7 tokens
✓ Correct
你好世界   → 2 tokens

When you need to count tokens

Estimate API costs
Before launch, paste a typical prompt, system prompt and retrieved context to get the tokens of the text itself; add the per-message template overhead (see “Plain-text tokens vs API counts”) for the input of each call, then multiply by price and call volume for a monthly estimate.
Stay within the context window
Long documents, chat history and retrieval results add up quickly. Count each part first, then decide what to cut or summarize.
Compare models on your language
The same Chinese passage can take twice as many tokens in one vocabulary as in another. Compare cost as price × your text's tokens in that model, not by price alone.
Size RAG chunks in tokens
Retrieval chunk sizes are usually set in tokens. Check how many tokens a real passage takes in the target model before fixing a character length per chunk.
Find out why a prompt is expensive
Text copied from web pages, Word or PDFs often carries zero-width spaces, non-breaking spaces and runs of whitespace that cost tokens without being visible. The split view marks them. To find each one by name and code point, use “Reveal invisible characters” in the Unicode Converter.

How tokens are cut

BPE: merging up from bytes
All five vocabularies are byte-level BPE (byte pair encoding). The text is turned into UTF-8 bytes, then adjacent pieces are merged into longer vocabulary entries in a fixed order until nothing more can be merged. The order comes from training statistics, so the same text stops at a different split in each vocabulary.
Why one character can be 2–3 tokens
A common Chinese character is 3 bytes in UTF-8. If the vocabulary contains it (or a word containing it), it is one token; if not, it stays as byte pieces — two or three tokens. GPT-4's cl100k_base is the least friendly to Chinese: of the 3,755 most common characters encoded one by one, only 14.1% are a single token, against 95.7% for DeepSeek and 99.9% for Qwen3.
Pre-tokenization: split first, then merge
Before BPE, a regular expression cuts the text into chunks, and merges never cross a chunk boundary. The rules differ: GPT-4o and GPT-4 group digits in threes, Qwen keeps one digit per chunk, and DeepSeek first isolates runs of Chinese characters and kana (up to U+9FA5 only; later characters follow the general rule). This tool reproduces each rule and pins the character classes to Unicode 16 — the version the reference implementations use — so results do not drift with your browser's Unicode version.
Plain-text tokens vs API counts
The counts are for the text itself: no beginning-of-sequence token and no chat template. APIs wrap each message in a template: the OpenAI Cookbook counting function adds 3 tokens per message, the role name and 3 tokens of reply priming — about 7 extra for one message; in Qwen's official documentation, 你好 is 1 token on its own and 11 once wrapped; DeepSeek does not document whether prompt_tokens includes its template. The model's answer and its thinking are billed as output tokens.
Where the vocabularies come from
o200k_base and cl100k_base come from the vocabulary files OpenAI publishes for tiktoken; DeepSeek from the tokenizer.json in the official DeepSeek-V4.1-Flash-1017 repository on Hugging Face (MIT); Qwen from the official Qwen3-8B and Qwen3.6-35B-A3B repositories (Apache-2.0). The tool keeps only what tokenizing needs — each token's bytes and the merge order — at 0.4–2.2 MB per vocabulary, downloaded from this site on first use. Sources and licenses are listed in THIRD_PARTY_NOTICES.txt next to the files.

Token estimation tips

Count with the target model's vocabulary
Counting DeepSeek or Qwen usage with a GPT tokenizer can be off by a factor of two on Chinese text. For Qwen, also pick the right generation: models from Qwen3.5 on use the “Qwen3.5 / 3.6 / 3.8” row.
Leave room for templates and output
The plain-text count is a floor. For context and cost, add the per-message template overhead, the system prompt and the expected output length; a reasoning model's thinking counts as output too.
Calibrate against the API's usage field
Once live, trust the usage the API returns. Count the same prompt here and compare with prompt_tokens: the difference is your template overhead, which you can add to future estimates.
Chunk by tokens, not characters
Set RAG chunk sizes and truncation limits in tokens. Mixed-language text, code and numbers change the ratio of characters to tokens a lot.
Clean invisible characters before sending
Look at the split view for text copied from web pages or documents. Zero-width spaces, non-breaking spaces and runs of whitespace all spend tokens for nothing. For whole web pages, strip tags and styles first with HTML to Markdown, then send the result to the model.

Token counter FAQ

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.

Related Tools

View all tools →

Case Converter — UPPERCASE, lowercase, camelCase & More

Text Processing

Convert text between UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE and 6 more formats instantly. Free, browser-only, no signup.

Lorem Ipsum Generator — Free Placeholder Text Tool

Text Processing

Generate Lorem Ipsum placeholder text instantly — by paragraph, sentence, word, byte, or list. Copy or download as plain text, HTML, Markdown, or JSON. 100% free, private, in-browser. No sign-up.

Free Regex Tester — Debug & Match Patterns Online

Text Processing

Test regex patterns instantly against any text. Live match highlighting, capture groups, replace preview, split, and pattern explainer. JavaScript-flavor regex, 100% private, no signup.

Remove Duplicate Lines from Text

Text Processing

Remove duplicate lines from text online — free, instant, 100% in your browser. Ignore case or whitespace, keep first or last occurrence, and see how many duplicates were removed. Also sort and clean up. No signup.

URL Slug Generator — Slugify Any Text

Text Processing

Slugify any title into a clean, SEO-friendly URL slug instantly. Transliterate accents and Cyrillic, or keep Unicode letters. 100% private, in your browser.

Sort Text Lines Alphabetically & Naturally

Text Processing

Sort text lines alphabetically, numerically (natural order), or by length — ascending or descending. Free online line sorter, 100% in your browser. Also dedupe, reverse, and clean up lists. No signup, nothing uploaded.