ÆON Toolhub

Token Counter

This free token counter shows exactly how many tokens your text uses, running the real OpenAI tokenizer in your browser. It also tells you how much of a context window that fills and what the call costs at the rates you enter. Pick GPT-4o and newer or the older GPT-3.5 and GPT-4.

Model
Tokens
97
Characters
18
Words
Chars / token

Exact count from the real OpenAI tokenizer, running in your browser.

Does it fit?Context window

0.0% of a 128k window · 128,000 tokens left

What will it cost?

Enter your own rates, so the result is right for your model today and never goes stale. Check the provider's pricing page for current numbers.

Add at least one rate above and the cost appears here.

Why does counting tokens matter?

Because tokens are the unit everything is measured in. Your API bill, the context window, the rate limit and the truncation point are all counted in tokens, never in words or characters. If you are building anything on a language model, the token count is the number that decides whether it works and what it costs.

Characters are a poor stand-in. The same sentence can be twenty tokens or forty depending on the language, the punctuation and whether it contains code. Guessing is how a prompt silently gets cut off in production, or how a feature that looked cheap in testing turns expensive at scale.

Is this count exact or an estimate?

Exact. This tool runs tiktoken, the same byte pair encoding tokenizer OpenAI publishes and uses, directly in your browser. The number you see is the number the model counts and the number you are billed on, for the encoding you select.

That is worth checking on any token counter you use. Many of them multiply your character count by a fixed ratio, which is fine for a rough sense and wrong in exactly the cases that matter: non-English text, code, and anything full of punctuation.

Why does the same text cost more tokens in another language?

Because the tokenizer packs English more densely than anything else. Measured with this tool on comparable samples:

ContentCharacters per token
English prose~5.1
Portuguese prose~3.8
JSON~2.8
Source code~2.65

Read that as a cost multiplier. The same paragraph translated from English to Portuguese costs roughly a third more tokens, and a block of source code costs close to double what the same number of characters of prose would.

It happens because the tokenizer's vocabulary was built mostly from English text, so common English words map to a single token while accented words get split into pieces. Code fares worst of all: every bracket, operator, indent and camelCase boundary tends to become its own token.

The characters per token figure on this page tells you where your own text sits. Below three, you are paying a premium; above five, your text is unusually token-efficient.

Will my prompt fit in the context window?

Pick your model's window size and the bar answers it, showing the percentage used and how many tokens are left, turning amber near the limit and red past it.

One thing people forget: the window has to hold the reply too. A prompt that fills 95% of a 128k window leaves almost no room for the model to answer, and you get a truncated or failed response rather than a helpful error. Leave room for the output you actually expect.

The window sizes offered here are the common round numbers rather than a list of specific models, because model limits change and a stale list would be worse than none. Check your provider's documentation and pick the matching size.

How do I work out what a prompt will cost?

Enter your rates and the tool does the arithmetic: input tokens divided by a million times the input rate, plus your estimated reply tokens divided by a million times the output rate, multiplied by how many requests you plan to make.

Two details that catch people out. Output is priced separately and is usually several times more expensive than input, so a short prompt that produces long answers can cost far more than a long prompt that produces short ones. And the cost per request looks trivially small until you multiply by volume, which is exactly why the requests field is there.

Why do I have to type the prices myself?

Because model pricing changes constantly, and a built-in price table would quietly go out of date while still looking authoritative. Being wrong about someone's money is worse than asking them to type a number.

Typing your rate takes a few seconds, it is saved in your browser so you only do it once, and it works for anything: a model released last week, a provider that is not OpenAI, or a negotiated enterprise rate that no public table would ever contain. Get the current numbers from your provider's own pricing page.

What about Claude and Gemini?

This counter is exact for OpenAI GPT models and does not pretend to be exact for the others. Claude and Gemini use their own tokenizers, and those are not published the way OpenAI publishes tiktoken, so any number shown here for them would be a guess dressed up as a measurement.

In practice the totals usually land in a similar range, so the count here is a reasonable sanity check for planning. When the number has to be right for billing, use each provider's own tool. The cost calculator above still works perfectly for those models, because you supply the rates.

Does anything leave my browser?

No. The tokenizer, the counting, the context maths and the cost calculation all run locally in JavaScript. Your text is never uploaded, logged or stored, and it is gone when you close the tab.

That matters for this tool in particular. The text people want to count tokens on is usually a system prompt, a customer record or a chunk of proprietary code, which is precisely the material you should not be pasting into someone else's server just to get a number back.

Read the guide: What Are Tokens in AI?Read more →

Frequently asked questions

What is a token?

A token is a chunk of text that a language model reads as a single unit. It is often a whole word, but common words, word pieces, spaces, and punctuation each count separately. As a rough guide, one token is about four characters of English, or roughly three quarters of a word.

How accurate is this token count?

It is exact, not an estimate. The tool runs the same byte pair encoding tokenizer that OpenAI uses, called tiktoken, directly in your browser. The number it shows is the same number the model counts and the same number your API usage is billed on, for the encoding you select.

Why does my text in another language cost more tokens?

Because the tokenizer was trained mostly on English, so English packs more characters into each token. Measured on the same tool, English averages about 5.1 characters per token while Portuguese averages 3.8, which means the same sentence translated costs roughly a third more tokens.

Why does code use so many tokens?

Punctuation, brackets, indentation and camelCase identifiers all split into separate tokens. Measured here, a line of JavaScript averages about 2.65 characters per token and JSON about 2.8, against roughly 5.1 for English prose. A code snippet costs close to double what the same length of prose would.

How do I work out what a prompt will cost?

Enter your provider rates per million tokens for input and output, estimate how many tokens the reply will use, and set how many requests you plan to make. The tool multiplies it out and shows the cost per request and the total. Your rates are saved in your browser.

Why do I have to type the prices myself?

Because model pricing changes often, and a built-in table would quietly go stale and give you the wrong number about real money. Typing your rate once takes seconds, works for any model including brand new ones, and handles negotiated enterprise pricing that no public table would have.

Will my prompt fit in the context window?

Pick your model window size and the bar shows the percentage used and how many tokens remain, turning amber as you approach the limit and red past it. Remember the window has to hold the reply too, so leave room for the output as well as your prompt.

Which models does each option cover?

The GPT-4o option uses the o200k_base encoding, which covers GPT-4o, GPT-4.1, GPT-4o mini, and the o1 models. The GPT-3.5 and GPT-4 option uses cl100k_base, which covers the original GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo. Pick the one that matches the model you are working with.

Does it count tokens for Claude or Gemini?

Not exactly, and this tool will not pretend otherwise. Claude and Gemini use their own tokenizers, which are not published the way OpenAI publishes tiktoken, so any number here would be a guess. The totals are usually in the same range, but use their official tools when the billing has to be exact.

Is my text sent anywhere?

No. The tokenizer runs entirely in your browser, so the text you paste never leaves your device and is not stored after you close the tab. You can safely check the token count of private prompts, code, or confidential content without it being uploaded to any server.

Last updated: September 17, 2026