GPT Token Counter
Count tokens for GPT-6, GPT-5.6 and GPT-4o prompts with the exact o200k tokenizer OpenAI uses — in your browser, with live per-model cost. Nothing is uploaded.
0
GPT tokens (exact)
$0
Input cost, cheapest model
0
Words
0
Characters
Loading tokenizer (≈2 MB, once)…
Each coloured block is one GPT token (o200k). Long or unusual words split into several; common English words are usually one.
Does it fit the context window?
How much of each model's limit your prompt uses, leaving room for the output length set below.
What this prompt costs.
Per request, and per month at your volume.
| Model | Your tokens | Input $/1M | Output $/1M | Per request | Per month |
|---|
Prices per million tokens from the providers' official pricing pages, verified . Standard (≤200K-token) tier, no caching or batch discounts. GPT counts are exact (o200k tokenizer, used by GPT-4o and later); Claude and Gemini counts are estimates — those tokenizers aren't public. Promotional rates are marked ◦. Confirm current pricing with the provider before budgeting.
How OpenAI's tokenizer splits English, code and JSON
o200k_base has a vocabulary of about 200,000 pieces. Common English words, including their leading space, are single tokens — " the", " because", " tokenizer". Rarer words split at morpheme-ish boundaries (" un" + "believ" + "able"), and anything the model has rarely seen — product codes, hashes, URLs — dissolves into two- or three-character fragments. Numbers are chunked in groups of up to three digits, which is why a 10-digit phone number is four tokens, not one.
Code and JSON pay a structural tax: every , ", : and newline is its own token, and camelCase identifiers split at each hump. A compact 1 KB JSON object commonly lands at 350–450 tokens, versus roughly 250 for 1 KB of prose. Three cheap fixes, in order of effect: minify (drop whitespace), shorten repeated keys, and send only the fields the model needs.
Non-Latin scripts are the expensive case. Hindi, Japanese and Arabic text can run 2–4× the token count of the same content in English on o200k, so a multilingual product should budget per language rather than per character.
How to use GPT Token Counter.
- 1
Paste your prompt, system message, or a document — or upload a .txt, .md, .json or code file
- 2
Read the exact GPT token count in the first tile; it updates as you type
- 3
Toggle "Show token boundaries" to see where the o200k tokenizer splits your text
- 4
Set expected output tokens and requests per day to see per-request and monthly cost for each GPT model
Why use this tool.
Stop guessing at 4 characters per token — get the number the API will bill
Trim system prompts with evidence: watch the count drop as you edit
Catch prompts that will overflow GPT-4o mini's 128K window before they fail in production
Safe for proprietary prompts and customer data — no server involved
About GPT Token Counter.
This GPT token counter runs OpenAI's o200k_base tokenizer directly in your browser, so the count you see is the count the API bills — not a characters-divided-by-four estimate. It covers every current OpenAI model in the cost table, from GPT-4o mini to GPT-6 Astra, shows whether your prompt fits each context window with room for the reply, and projects monthly spend from your daily request volume. The boundary view makes tokenization visible, which is the fastest way to learn why JSON, code and long identifiers cost more than plain English and how to trim them. Prompts never leave your device.
Frequently asked questions.
Is this the same tokenizer ChatGPT uses?
Yes for the API models. GPT-4o, GPT-5.x and later use the o200k_base encoding, which this tool runs in your browser via the gpt-tokenizer library. Counts match what the OpenAI API bills for input tokens. (The chat UI also injects hidden system text, so a ChatGPT conversation uses slightly more than your visible message.)
Does it work for GPT-6?
GPT-6 Astra is listed in the cost table at its published price. OpenAI has not announced a new tokenizer for it, so counts assume o200k; if that changes the tool will be updated and this answer revised.
Why is a JSON payload so many tokens?
Braces, quotes, colons and every camelCase key fragment become separate tokens. Turn on the boundary view and you will see it. Minify the JSON and shorten keys before sending it to a model — it is the cheapest optimisation there is.
What is the difference between o200k and cl100k?
cl100k_base was the encoding for GPT-3.5 and GPT-4. o200k_base, introduced with GPT-4o, has a larger vocabulary and is roughly 5–15% more efficient on most languages, so the same text produces fewer tokens. This tool uses o200k because every current OpenAI model does.
Is my text sent to OpenAI or to you?
Neither. The tokenizer runs as JavaScript in your browser tab. You can load the page, disconnect from the internet, and it still counts.
Guides for this tool.
- How many tokens is my prompt? GPT, Claude and Gemini counted on the same text
The four-characters-per-token rule breaks budgets. How each provider actually tokenizes English, code, JSON and other languages, why the counts differ, and how to get an exact number without sending your prompt anywhere.