How Many Tokens Is My Text? (And How to Estimate API Cost)

Updated June 2026 · ~4 min read

If you're building with the OpenAI, Anthropic or Google APIs, your bill is measured in tokens — not words or characters. Knowing roughly how many tokens your prompt uses helps you predict cost and stay within context limits. Here's the quick version, plus a free token & cost calculator.

What is a token?

A token is a chunk of text — often a word or part of a word. Common rules of thumb for English:

Code, punctuation and non-English text tokenize differently, so these are estimates — use a real tokenizer for exact counts.

How to estimate API cost

Cost = (input tokens × input price) + (output tokens × output price). Prices are quoted per 1 million tokens, and output usually costs more than input. So:

🧮 Count tokens & compare prices →
Free Token Cost Calculator — paste text, see the token count and compare GPT / Claude / Gemini costs side by side.

Ways to cut token cost

廣告 Ad

FAQ

Is token count the same across models? No — different models use different tokenizers, so the same text can be a slightly different number of tokens.

Does output cost more than input? Usually yes — check each provider's per-million-token pricing.