AI Token Counter

Count tokens in text for GPT and other LLMs with an accurate BPE tokenizer — see token, character, and word counts and estimate API cost. Runs in your browser.

Runs entirely in your browser — nothing is uploaded.
Tokens
0
Characters
0
Words
0
Enter a price to estimate cost.

The AI Token Counter tells you how many tokens a piece of text uses for large language models like GPT-4o and GPT-4. Paste a prompt or document and it counts the tokens with a real BPE tokenizer — the same kind the models use — alongside character and word counts, so you can see exactly how much of a context window your text will take.

Tokens, not words, are what LLMs read and what you are billed for, so counting them is essential for staying within a model’s context limit and estimating API cost. Enter a price per million tokens and the tool works out the cost too. Everything runs in your browser, so your prompts are never uploaded.

How to count tokens

  1. Paste or type your text into the box.
  2. Choose the model/encoding — GPT-4o and o-series use one tokenizer, GPT-4 and GPT-3.5 another.
  3. Read the token count, plus characters and words.
  4. Optionally enter a price per 1M tokens to estimate the cost.

What is a token?

A token is a chunk of text — often a word, part of a word, or a piece of punctuation — produced by the model’s tokenizer. Common English words are usually a single token, while longer or rarer words split into several, and whitespace and symbols count too. As a rough rule of thumb, one token is about four characters or three-quarters of a word of English, but the only accurate way to know is to run the actual tokenizer, which is what this tool does.

Why token counts matter

Every model has a context window measured in tokens (the combined size of your input and its output), so if your prompt plus the expected response exceeds it, the request fails or gets truncated. Pricing is also per token, usually quoted per million, with input and output charged at different rates. Counting tokens before you send a request lets you trim prompts to fit, batch content sensibly, and predict cost instead of being surprised by a bill.

Which tokenizer to choose

Different model families use different tokenizers, so the same text can be a slightly different number of tokens depending on the model. GPT-4o, GPT-4.1, and the o-series use the o200k_base encoding, while GPT-4 and GPT-3.5 Turbo use cl100k_base — pick the one that matches your model for an exact count. Anthropic’s Claude uses a proprietary tokenizer that is not published, so the Claude option here is a close approximation using a comparable tokenizer rather than an exact figure.

Frequently Asked Questions

How many tokens is my text?

Paste it into the counter and pick your model. The tool runs the model’s tokenizer and shows the exact token count for GPT models, plus characters and words.

How many tokens is a word roughly?

As a rough guide, one token is about ¾ of a word or four characters of English, so 100 tokens is roughly 75 words. For an exact number, use the counter, since it depends on the specific words and punctuation.

Why do GPT-4o and GPT-4 give different counts?

They use different tokenizers — GPT-4o and the o-series use o200k_base, while GPT-4 and GPT-3.5 use cl100k_base — so the same text can tokenize to slightly different totals. Select the model you are targeting.

Is the Claude token count exact?

No. Anthropic does not publish Claude’s tokenizer, so the Claude figure is an approximation using a comparable BPE tokenizer. GPT counts are exact.

How do I estimate the cost of a prompt?

Enter the model’s price per million tokens in the cost box and the tool multiplies it by the token count. Remember that input and output tokens are usually priced differently.

Is my text private?

Yes. The tokenizer runs entirely in your browser, so your prompts and documents are never sent to a server.