Token counter and LLM cost calculator

Paste a prompt or a document. You see the token count as you type, where the text splits into tokens, and what the requests cost at the prices you enter.

Free, no account needed. Updated .

Short answer

A token counter splits text the way a language model does and counts the pieces. This one runs the OpenAI encodings o200k_base (GPT-4o, GPT-4.1, GPT-5) and cl100k_base (GPT-4, GPT-3.5 Turbo) in your browser; Claude, Gemini, Llama and Qwen models use their own tokenizers, so their counts differ.

How to count tokens

  1. Paste your text. A prompt, a system message, a help article or a chat transcript. The count updates as you type, up to 1,000,000 characters.
  2. Pick the encoding. o200k_base for GPT-4o, GPT-4.1, GPT-5 and the o-series models, cl100k_base for GPT-4 and GPT-3.5 Turbo. The first count loads the encoding, about 1 to 2 MB, once.
  3. Add prices for a cost estimate. Enter the input and output price per million tokens from your provider's pricing page, the output tokens you expect per request, and how many requests you plan.

Open See where the text splits into tokens to see the first 300 tokens, each one shaded, with its token id when you point at it.

What a token is

Language models do not read letters or words. A tokenizer cuts the text into pieces from a fixed vocabulary: common words are one piece, rare words are several, and spaces usually belong to the word after them. The model reads and writes these pieces, and providers bill by them. A model's context window, the most text it can take in one request, is also counted in tokens.

OpenAI's rule of thumb for English is about 4 characters per token, or three quarters of a word. Your own text can be far from that, which is why counting beats guessing.

Examples: the same text, two encodings

These counts come from this tool, with the tokenizer it uses:

Token counts in two OpenAI encodings
Texto200k_basecl100k_base
Hello, world!44
You can return an item within 30 days for a full refund.1414
Rückerstattung innerhalb von 30 Tagen (German)912
退款政策 (Chinese, "refund policy")25
👍 (one emoji)13

Simple English costs the same in both. The newer o200k_base vocabulary is twice as large and holds more pieces for other languages and emoji, so non-English text often needs fewer tokens.

Other models count differently

This tool runs gpt-tokenizer 4.0.0, an open source JavaScript version of OpenAI's tiktoken encodings. It is exact for OpenAI models that use these encodings. Claude (Anthropic), Gemini (Google), Llama (Meta), Mistral and Qwen models each train their own tokenizer, so they split the same text into a different number of pieces. For those models, use the count here as an estimate, and use the token counting endpoint or the usage numbers in the provider's API response when you need the real figure.

Two more things change the real count of a request:

  • Chat format. Each message in a chat request adds a few tokens for its role and separators.
  • Everything you send. The system prompt, earlier messages, tool definitions and retrieved documents all count as input tokens, on every request.

How the cost estimate works

Cost = tokens ÷ 1,000,000 × price per million tokens, for input and output separately, then times the number of requests. Output tokens usually cost more than input tokens, so a long answer can cost more than a long prompt.

We do not build in other vendors' prices: they change often, and a stale price is worse than none. The one example is the model our own free tools run on, Cloudflare Workers AI @cf/qwen/qwen3-30b-a3b-fp8, at $0.051 per million input tokens and $0.335 per million output tokens (Cloudflare pricing page, read 29 October 2026). Check the current price before you rely on it.

A worked example with those prices: a request with 1,200 input tokens and 300 output tokens costs

  • input: 1,200 ÷ 1,000,000 × $0.051 = $0.0000612
  • output: 300 ÷ 1,000,000 × $0.335 = $0.0001005
  • per request: $0.0001617, so 10,000 requests cost about $1.62.

Qwen uses its own tokenizer, so the OpenAI count is an estimate for it. Treat the result as the right order of magnitude, not as an invoice.

How to use fewer tokens

  • Send clean text. HTML tags, inline styles and page menus are tokens too. Convert pages with the HTML to Markdown converter and PDFs with PDF to text first.
  • Send only what the question needs. A support bot does not need the whole help center in every request. Search for the few passages that match the question and send those.
  • Limit the answer. Set a maximum output length for each request type.
  • Trim long chats. Old messages are sent again with every new one. Summarize or drop the oldest turns.

That second point is how Paperlink AI works: it searches your own help pages and documents for the passages that answer a customer's question and sends only those to the model, and when they do not hold the answer, the bot says so.

Your text stays here

The tokenizer runs in your browser. The text you paste is not sent to OpenAI or to our servers, and analytics record only that a count ran.

Frequently asked questions

How many tokens is a word?

OpenAI's rule of thumb for English is about 4 characters, or three quarters of a word, per token. Other languages, code and long numbers use more tokens per word. The counter shows the characters per token for your own text.

Which tokenizer does GPT-4o use?

GPT-4o, GPT-4o mini, GPT-4.1, GPT-5 and the o-series models use o200k_base. GPT-4 and GPT-3.5 Turbo use cl100k_base. The counter offers both; pick the encoding of the model you call.

Why does Claude or Gemini count a different number of tokens?

Each model family trains its own tokenizer with its own vocabulary, so Anthropic, Google, Meta and Qwen models split the same text differently. Use this count as an estimate for them, and use the vendor's own token counting API when you need the exact number.

Does the token count include the chat format?

No. It counts the text you paste. A chat request also adds a few tokens per message for roles and separators, plus the system prompt and any tool definitions you send. Add those to the input tokens for a cost estimate.

Why are there no model prices built in?

Prices change often, and a wrong price is worse than none. Copy the current input and output prices from your provider's pricing page. The one example, Workers AI Qwen3 30B, shows the date it was read.

Is my text sent to OpenAI to count tokens?

No. The tokenizer runs in your browser. The text is not sent to OpenAI or to our servers.

Newsletter

Support notes, once a month.

One email with what we learn about help centers, honest AI answers and support teams. Unsubscribe at any time.

We use your email only for this newsletter. See the Privacy Policy.