---
title: "Token counter for DeepSeek, Qwen, GLM, Gemma and GPT"
description: "Free LLM token counter with the real tokenizers for DeepSeek, Qwen, GLM, Gemma and GPT. See every token, the count per model and the cost, in your browser."
url: https://broadrouter.com/tools/token-counter/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# LLM token counter

Updated 2026-11-15

**In short:** A token is the unit an LLM reads and bills: about 4.6 characters, or 0.78 English words, on average in our open dataset. Each model family has its own tokenizer, so counts differ: Arabic and code vary most. Paste text for counts with each model's own tokenizer (Gemma's from its base model) and the cost per model.

Free, no sign-up, runs in your browser: nothing you type is sent anywhere.

Try:

 Chat format: add a system prompt and the model's chat-template tokensSystem promptYou are a helpful assistant.Text to countEvery request you send to a language model is split into tokens before the model reads it. A token can be a whole word, part of a word, a space, a number or a punctuation mark. Common English words such as "the", "model" and "price" are usually one token each, while rare words, names and long technical terms are broken into several pieces. Because providers bill per token, the same text can cost different amounts on different models. Each model family trains its own tokenizer on its own mix of languages and code, so its vocabulary decides how efficiently a sentence is packed. A tokenizer trained mostly on English packs English tightly and spends more tokens on Arabic, Hindi or Chinese. A tokenizer with a larger vocabulary usually needs fewer tokens for the same text, but it is not a guarantee. The practical lesson is simple. Count tokens with the tokenizer of the model you will actually call, not with a rule of thumb. Rules of thumb are fine for a first budget, yet they drift by twenty or thirty percent as soon as the text is not plain English. When the bill matters, measure a real sample, keep the numbers, and check them again whenever you switch models or change your prompt template. Context windows are counted in tokens too. A model with a window of one million tokens can read a very long contract or a large code base in one request, but only if the prompt, the history and the answer all fit inside that limit together.

…

tokens

Show tokens forDeepSeek V4.1 Flash — DeepSeek V4.1 Flash tokenizerGLM 5.3 — GLM 5.3 tokenizerQwen3.8 27B — Qwen3.8 27B tokenizerGemma 4 VL 26B — Gemma 4 tokenizer (Google base model)GPT (o200k) — OpenAI o200k\_base Show token IDs Show spaces

Tokens and cost of this text per model
| Model | Tokens | Chars per token | As input | As output |
| --- | --- | --- | --- | --- |
| **DeepSeek V4.1 Flash** · DeepSeek V4.1 Flash tokenizer | … | … | … | … |
| **GLM 5.3** · GLM 5.3 tokenizer | … | … | … | … |
| **Qwen3.8 27B** · Qwen3.8 27B tokenizer | … | … | … | … |
| **Gemma 4 VL 26B** · Gemma 4 tokenizer (Google base model) | … | … | … | … |
| **GPT (o200k)** · OpenAI o200k\_base | … | … | … | … |

Cost = tokens × the model's published price per 1M input or output tokens. GPT is shown for reference only (no BroadNet price). Measured ratios for every tokenizer are in the [tokenizer efficiency dataset](https://broadrouter.com/data/tokenizer-efficiency/). Rows marked ≈ are estimates from measured characters per token until you load that tokenizer; loading downloads its tokenizer.json from Hugging Face once and keeps it in your browser cache.

[Create an account ($5 starting credit)](https://inference.broadnet.ai/?utm_source=broadrouter&utm_medium=referral&utm_campaign=tools-token-counter&utm_content=tool) ·

Per-model counters: [DeepSeek token counter](https://broadrouter.com/tools/deepseek-token-counter/) · [GLM token counter](https://broadrouter.com/tools/glm-token-counter/) · [Qwen token counter](https://broadrouter.com/tools/qwen-token-counter/) · [Gemma token counter](https://broadrouter.com/tools/gemma-token-counter/) · [GPT token counter](https://broadrouter.com/tools/gpt-token-counter/). Prices synced 2026-11-14.

[Report a wrong price or number](mailto:info@broadnet.ai?subject=Wrong%20price%20or%20number%20on%20LLM%20token%20counter&body=Page%3A%20https%3A%2F%2Fbroadrouter.com%2Ftools%2Ftoken-counter%2F%0A%0AWhat%20looks%20wrong%20(model%2C%20figure%20shown%2C%20correct%20figure%20and%20a%20source%20link%20if%20you%20have%20one)%3A%0A) (email to info@broadnet.ai, with this page's link and your inputs filled in).

## How it works

1.  Paste text, code or JSON into the box, or pick a sample. The count updates as you type.
2.  Pick which tokenizer to view. The text is shown split into tokens, with a colour per token; tick "Show token IDs" to see the numbers.
3.  Tick "Chat format" to add a system prompt and the template tokens a chat request adds around messages.
4.  Read the table: tokens, characters per token and the input and output cost for each model. Load the other real tokenizers to replace estimates with real counts, then copy the link or download CSV.

## Which tokenizer each model uses

Every count on this page comes from a real tokenizer file, pinned to a specific commit so the numbers do not drift. We checked on 2026-11-15 that each repository is public, not gated, and that the browser library produces the same token IDs as Hugging Face's Rust `tokenizers` reference on every sample below.

| Model | Tokenizer source | Token IDs | Context | Download |
| --- | --- | --- | --- | --- |
| [DeepSeek V4.1 Flash](https://broadrouter.com/models/deepseek-v4.1-flash/) | [deepseek-ai/DeepSeek-V4.1-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash) · exact model tokenizer | 129,280 | 1,048,576 | 2 MB |
| [GLM 5.3](https://broadrouter.com/models/glm-5.3/) | [zai-org/GLM-5.3](https://huggingface.co/zai-org/GLM-5.3) · exact model tokenizer | 154,856 | 1,048,576 | 20 MB |
| [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/) | [Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B) · exact model tokenizer | 248,077 | 262,144 | 13 MB |
| [BroadNet Gemma 4 VL 26B](https://broadrouter.com/models/gemma-4-vl-26b/) | [google/gemma-4-26B-A4B-it](https://huggingface.co/google/gemma-4-26B-A4B-it) · base-model tokenizer | 262,144 | 32,768 | 32 MB |
| GPT-4o, GPT-4.1, o-series, GPT-5 (reference) | o200k\_base via gpt-tokenizer · exact model tokenizer | 200,019 | varies | 1.1 MB |

Google's Gemma 4 26B A4B tokenizer. BroadNet's build is based on this model; we assume it keeps the base tokenizer.

## Same text, different token counts

We ran each tokenizer on the same open-licensed texts (method below). The table shows tokens per 100 words; lower is cheaper for the same text.

| Sample | Words | DeepSeek | GLM | Qwen | Gemma | GPT |
| --- | --- | --- | --- | --- | --- | --- |
| English prose | 1183 | 127 | 129 | 132 | 130 | **127** |
| Arabic (Modern Standard) | 39037 | 222 | 244 | **183** | 203 | 189 |
| Gulf Arabic | 203 | 232 | 251 | 221 | 226 | **205** |
| Chinese (Simplified) | 45649 | 112 | 114 | **111** | 129 | 148 |
| Spanish | 52022 | 155 | 150 | 139 | **135** | 135 |
| Hindi | 51486 | 293 | 455 | 215 | **138** | 164 |
| Code: Python | 280 | 211 | **200** | 215 | 234 | 203 |
| JSON | 1706 | 401 | 411 | 484 | 494 | **389** |

Method: Parallel text: FLORES-200 dev and devtest (2,009 aligned sentences per language, CC BY-SA 4.0, tarball pinned by SHA-256) for Modern Standard, Egyptian, North Levantine, Najdi and Mesopotamian Arabic, Hindi, Urdu, Chinese, French and Spanish against English, each sentence counted on its own; Tatoeba sentence pairs (CC BY 2.0 FR) for Gulf Arabic and Arabizi. Ratio = pooled tokens ÷ pooled tokens of the English side, with a 95% interval from a seeded bootstrap over sentences (10,000 resamples). Other texts: Wikipedia lead sections (CC BY-SA 4.0), Project Gutenberg (public domain) and Wikidata JSON (CC0), stored with source URL, licence and revision. Tokens: the official tokenizer file at a pinned Hugging Face commit, encoded with @huggingface/tokenizers with no special tokens; o200k\_base via gpt-tokenizer; Kimi's tiktoken rank file with a tiktoken-compatible counter. Gated Meta and Google files were read from ungated mirrors proven byte-identical to the official file. Every new count matched the Rust tokenizers library or Python tiktoken. Words: word-like segments from Intl.Segmenter. Characters: Unicode code points. Measured 2026-11-15. Bold = fewest tokens. Download the counts as CSV or JSON from the [tokenizer efficiency dataset](https://broadrouter.com/data/tokenizer-efficiency/).

English is nearly a tie. The spread opens up on other scripts: on Modern Standard Arabic the counts range from 183 to 244 tokens per 100 words. That is why a model with a lower price per million tokens can still cost more for your text. The [Arabic token counter](https://broadrouter.com/tools/arabic-token-counter/) measures this for your own text.

## The cost formula

```
input cost  = prompt tokens     × input price per 1M  / 1,000,000
output cost = completion tokens × output price per 1M / 1,000,000
```

Worked example: the English sample in the counter is 260 words and 299 tokens with the DeepSeek V4.1 Flash tokenizer. Sent as a prompt it costs $0.000052, or $0.0523 for 1,000 such requests. Cached input and reasoning tokens change the bill; the [LLM API cost calculator](https://broadrouter.com/tools/llm-api-cost-calculator/) handles both. See also [input and output tokens](https://broadrouter.com/glossary/input-and-output-tokens/).

## What the chat format adds

An API request is not just your text. The server wraps each message in the model's chat template: role markers, special tokens and, for these reasoning models, a short reasoning-effort preamble. With the official templates' default settings a one-message request adds about 12 to 52 tokens depending on the model, plus a few per extra message. Tool definitions add far more. Tick "Chat format" to see the exact template tokens in the token view.

## Questions

### How do I count tokens for DeepSeek, Qwen, GLM or Gemma?

Paste your text above. The counter runs each model's own tokenizer.json, downloaded from the model's official Hugging Face repository, in your browser. OpenAI-only counters such as tiktoken give the wrong number for these models because each family has its own vocabulary.

### Is the count the same as the API will bill?

For the text itself, yes for DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B, whose tokenizers come from the exact model repositories. A real chat request also adds template tokens around each message; tick "Chat format" to include them as the official chat template renders them. The `usage.prompt_tokens` field in the API response is always the final word.

### Why does the same text have different token counts on different models?

Each model family trains its own tokenizer with its own vocabulary, from about 129,000 to 262,000 token IDs here. A vocabulary trained on more Arabic, Hindi or Chinese packs those languages into fewer tokens. In our dataset 100 words of Hindi take from 138 to 455 tokens depending on the tokenizer.

### How many tokens is 1,000 words?

About 1,290 tokens for English prose, averaged over these five tokenizers (127 to 132 per 100 words, measured on 1,183 words of open-licensed prose). Code, JSON and Arabic need far more. See the [tokens to words converter](https://broadrouter.com/tools/tokens-to-words/) for every content type.

### Why does a tokenizer need to download first?

A tokenizer is a vocabulary plus merge rules, stored in a tokenizer.json of 2 MB to 32 MB. The counter fetches one only when you use it and keeps it in your browser cache, so the next visit is instant. Until then the row shows an estimate marked ≈.

### Do output and reasoning tokens use the same tokenizer?

Yes. The model writes with the same vocabulary, so this counter also tells you what a reply of that length costs as output. Reasoning tokens are billed as output too. [What reasoning tokens are](https://broadrouter.com/glossary/reasoning-tokens/).

## Go deeper

-   [Arabic token counter: the Arabic tax per tokenizer](https://broadrouter.com/tools/arabic-token-counter/)
-   [Context window calculator: will my document fit?](https://broadrouter.com/tools/context-window-calculator/)
-   [Tokens to words converter, by language and content type](https://broadrouter.com/tools/tokens-to-words/)
-   [What is a token?](https://broadrouter.com/glossary/token/)
-   [LLM API pricing explained](https://broadrouter.com/blog/llm-api-pricing-explained/)
-   [BroadNet Inference prices per model](https://broadrouter.com/pricing/)

## More free tools

-   [**LLM API cost calculator**Price a workload on every model at once, with cache hits, reasoning and a flat-plan check.](https://broadrouter.com/tools/llm-api-cost-calculator/)
-   [**Speech-to-text cost calculator**Hours, calls or voice notes to a monthly transcription bill, against your current provider.](https://broadrouter.com/tools/speech-to-text-cost-calculator/)
-   [**Arabic token counter**Arabic vs English token counts per tokenizer: the "Arabic tax" in tokens and money.](https://broadrouter.com/tools/arabic-token-counter/)
-   [**Tokens to words converter**Tokens ↔ words ↔ characters ↔ pages, by language and content type.](https://broadrouter.com/tools/tokens-to-words/)
-   [**Context window calculator**Will it fit? Window used per model, room left for output, cost to send.](https://broadrouter.com/tools/context-window-calculator/)
-   [**Flat-rate vs per-token LLM cost calculator**Break-even between an unlimited plan and paying per token, per agent.](https://broadrouter.com/tools/flat-rate-vs-per-token-calculator/)
-   [**Prompt caching savings calculator**Bill with and without caching, by prefix share and hit rate.](https://broadrouter.com/tools/prompt-caching-calculator/)
-   [**Image token calculator**Tokens and cost per image under each model's documented rule. Drop an image; nothing is uploaded.](https://broadrouter.com/tools/image-token-calculator/)
-   [**Self-hosting vs API cost calculator**GPU rental against your current API and BroadNet per-token and flat-plan prices: cost per 1M tokens and break-even volume.](https://broadrouter.com/tools/self-hosting-vs-api-calculator/)
-   [**Embedding cost calculator**Index, update and query costs for a corpus at OpenAI, Google, Voyage, Mistral and Jina list prices.](https://broadrouter.com/tools/embedding-cost-calculator/)
-   [**LLM rate limit and concurrency calculator**Which limit binds first: RPM, TPM or concurrency, with Little's law.](https://broadrouter.com/tools/llm-rate-limit-calculator/)
-   [**JSON schema generator for LLM structured output**Sample JSON to strict schema, Pydantic, Zod and a ready request.](https://broadrouter.com/tools/json-schema-generator/)
-   [**OpenAI-compatible API request builder**One request, copied as curl, Python, Node or the OpenAI SDKs.](https://broadrouter.com/tools/api-request-builder/)
-   [**Audio file splitter for speech-to-text limits**Chunk count, overlap and copy-ready ffmpeg commands to fit a transcription file-size limit.](https://broadrouter.com/tools/audio-splitter-ffmpeg/)
-   [**Agent run cost estimator**Context growth per step, total tokens and cost of one agent run, with a DeepSeek session comparison.](https://broadrouter.com/tools/agent-run-cost-estimator/)
-   [**OpenAI to BroadNet migration helper**Paste OpenAI SDK code; get base URL, key and model edits, a diff and the checks that remain.](https://broadrouter.com/tools/openai-to-broadnet-migration/)
-   [**Arabic text normalizer**Tashkeel, tatweel, alef, ya, ta marbuta, digits and invisible characters, with a matching Python function.](https://broadrouter.com/tools/arabic-text-normalizer/)
-   [**RAG chunking calculator**Chunks, embedding tokens, input per query, context check and monthly LLM cost for a RAG pipeline.](https://broadrouter.com/tools/rag-chunking-calculator/)
-   [**max\_tokens calculator for reasoning models**Answer length + reasoning budget + margin = a max\_tokens that does not cut the answer off.](https://broadrouter.com/tools/reasoning-token-budget/)
-   [**LLM batch job planner**Run time, binding limit, cost per model and the flat sessions needed to finish a big job by a deadline.](https://broadrouter.com/tools/llm-batch-job-planner/)
-   [**LLM JSON output validator**Parse errors by line and column, safe repairs, cut-off detection and JSON Schema checks for model output.](https://broadrouter.com/tools/llm-json-output-validator/)
-   [**Prompt token diff**Two prompt versions side by side: changed lines, exact token delta and the monthly cost difference.](https://broadrouter.com/tools/prompt-token-diff/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=tools-token-counter&utm_content=page-cta) ·

**Sources**

-   [BroadNet Inference machine-readable prices (pricing.json)](https://inference.broadnet.ai/pricing.json?utm_source=broadrouter&utm_medium=referral&utm_campaign=tools-token-counter&utm_content=sources)
-   [DeepSeek V4.1 Flash tokenizer: tokenizer.json on Hugging Face (deepseek-ai/DeepSeek-V4.1-Flash)](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash)
-   [GLM 5.3 tokenizer: tokenizer.json on Hugging Face (zai-org/GLM-5.3)](https://huggingface.co/zai-org/GLM-5.3)
-   [Qwen3.8 27B tokenizer: tokenizer.json on Hugging Face (Qwen/Qwen3.8-27B)](https://huggingface.co/Qwen/Qwen3.8-27B)
-   [Gemma 4 tokenizer (Google base model): tokenizer.json on Hugging Face (google/gemma-4-26B-A4B-it)](https://huggingface.co/google/gemma-4-26B-A4B-it)
-   [gpt-tokenizer (o200k\_base encoding)](https://github.com/niieani/gpt-tokenizer)
-   [OpenAI cookbook: counting chat tokens](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
