CodingBubbleCodingBubble

LLM Token Counter

Count the tokens in a prompt and compare estimated API costs across models.

Loading tokenizer...

0
Tokens
0
Words
0
Characters
ModelInput $/1MOutput $/1MCost per requestPer 1,000 requests

Standard list prices checked on 27 November 2026, without batch or caching discounts. Long-prompt tiers are applied where listed. Check the official pages: Anthropic, OpenAI, Google.

What is a token?

Language models read text as tokens: short pieces that can be a whole word, part of a word, a space or a punctuation mark. API providers charge per token, and every model has a limit on how many tokens fit in one request, called the context window. As a rough guide, one token is about four characters of English text, but code, numbers and other languages often use more.

How to use the token counter

Paste your prompt, system instructions or document into the text box. The token, word and character counts update as you type. Then enter how many tokens you expect the model to reply with. The table shows the estimated cost of one request and of 1,000 identical requests for each model.

For a chat application, include the system prompt and the conversation history you send each time, because all of it is billed as input on every request. Tool definitions and images also add input tokens that this page does not count.

How accurate is it?

The count uses o200k_base, the open tokenizer OpenAI published for GPT-4o and related models. Other model families split text differently, so their real counts can be noticeably higher or lower. Use these figures for planning, and use your provider's token counting endpoint or the usage field in API responses for exact billing numbers.

Ways to lower token costs

Remove repeated instructions and unused examples, send only the parts of a document that matter, trim old conversation turns, and ask for shorter answers. Output tokens usually cost several times more than input tokens. Most providers also offer cheaper rates for cached or batched requests, and smaller models are often good enough for classification and extraction.

Frequently asked questions

Is my text sent to a server?

No. Counting happens in your browser. Only the tokenizer files are downloaded, from the esm.sh CDN.

How many words are 1,000 tokens?

For typical English text, about 750 words. The ratio changes with the language and with how much code the text contains.

Why do models give different token counts?

Each model family has its own tokenizer, so the same sentence can be split into a different number of pieces.

Are the prices guaranteed?

No. They are list prices checked on the date shown under the table. Providers change prices, so confirm on the official pricing page.

Related tools