Token Counter

Paste text or drop a file, pick a model, and see the token count with the tokenizer that produced it, plus how much of that model's context window it fills. GPT and Llama are counted exactly, in this tab. Claude and Gemini publish no tokenizer, so those are labelled estimates and the page shows the range.

0tokens
Exacto200k_base
Characters
0
Words
0
Chars per token
0
Context window0 of 400K

As one chat message the request costs about 6 tokens. OpenAI's cookbook counts 3 tokens for each message wrapper and 3 more to prime the reply. A name field on a message adds one. The window also holds the system prompt, your tools, the earlier turns and the reply, so read this as a floor.

GPT-5 numbers from the vendor's own docs

tiktoken maps every gpt-5 name to o200k_base, so this count matches what the API bills. The 400,000 window covers the input and the reply together.

One text, four different numbers

A token is not a word and not a character. It is a chunk of bytes that one model learned to treat as a single unit, and each family learned a different set of chunks. The word antidisestablishmentarianism is six tokens on GPT-5. A waving hand emoji is two there and three on GPT-4 Turbo. A paragraph of Russian costs about twice what the same paragraph costs in English.

So this page asks you to pick a model before it prints a number. A counter that shows one figure for everything is showing you one tokenizer and hoping you do not notice.

Where the number is exact

OpenAI publishes its tokenizers and Meta publishes the Llama 3 one, so those counts are the real thing. They run here in your browser and they match tiktoken, checked against OpenAI's own test fixtures every time the tests run. The badge says Exact and names the encoding: o200k_base for GPT-4o and later, cl100k_base for GPT-4 and GPT-3.5.

Anthropic and Google publish nothing you can run offline. For those the badge says Estimate and the page shows a range, built from the ratios each vendor documents itself. I would rather show a range than a number I cannot back. Claude Opus 4.7 changed tokenizer and the same text now costs about thirty percent more, so the older Claude models here use the older ratio instead of one average for both.

The split is where the money is

The tiles under the box are the real token boundaries. Long words break into pieces. A space usually rides along with the word after it. A tile ringed in amber is one character that took several tokens. That is the expensive case, and it matters most in a prompt you send a thousand times a day.

The line table ranks what to cut. A pasted log or a base64 blob will often cost more than every instruction around it, and the share column says by how much.

What the count leaves out

The context window holds the whole conversation, not one message. Your system prompt, the tool definitions, every earlier turn, the images and the model's own reply all draw on the same budget. Reasoning models spend hidden tokens on thinking that no counter can see.

So read the bar as a floor. If it says a prompt fills eighty percent of the window, you have less room left than it looks. If you need the billed figure to the token, every vendor has a count endpoint that returns it, and every one of them wants your API key.

Drop the file instead of pasting it

The question behind most of these searches is whether a document fits in one request. I checked thirty token counters for this. Not one of them has a file input. Every one is a bare text box, so you paste a contract in and hope the clipboard held all of it.

This page takes the file. PDF, DOCX, Markdown, JSON, CSV or a source file, dropped on the box or picked from the dialog. The reading happens here, the same way the counting does. A PDF pulls the pdf.js worker from a public CDN the first time, and your file still never leaves the tab.

You do not sign in. The vocabulary file is a few megabytes and arrives the first time you pick a model that needs it, with the count showing a spinner until it lands. After that it sits in the browser cache.

If you are counting because a prompt got too long, the Word and Character Counter gives you the platform limits instead, and the JSON Formatter will shrink a payload before you paste it into a prompt.

Common questions

Does the text I paste leave my browser?

No. The tokenizer runs in this tab. The vocabulary file downloads once from this site, and after that the counting is local, so you can pull the network cable and keep counting. Mixpanel and Google Analytics load with Softery.io and see that someone opened the tool and which model they picked. They do not get the text.

Why is Claude only an estimate?

Anthropic has published no tokenizer for Claude 3 or anything after it. The old @anthropic-ai/tokenizer package covers models from 2023, and its own README says it is no longer accurate. So this page uses the ratios Anthropic publishes, shows a range instead of one number, and says estimate on the badge. The exact figure comes from their count_tokens endpoint, which needs an API key.

Why did one emoji cost three tokens?

A tokenizer works on bytes, not on characters. A waving hand is four bytes of UTF-8, and cl100k_base has no single token for it, so it gets cut into pieces. The same emoji costs two tokens on o200k_base and three on cl100k_base. The tiles with an amber ring are those cases.

Will the API bill me the number on this page?

It will bill you more. This counts the text on its own. A real request also carries the system prompt, the tool definitions, the earlier turns, the message wrappers and the reply. For OpenAI the wrappers are documented and the page adds them up for a single message. Nobody else has published a figure, so the count here is a floor.

Looking for something else?