Token Calculator: Count Tokens and API Cost

Token Calculator

Count tokens with real AI tokenizers and calculate the API cost for GPT, Claude, Gemini, Grok, DeepSeek and Mistral.

Counting happens in your browser. Files: text, Markdown, CSV, JSON, code or .docx, up to 20 MB.

Tokens
0
Rough estimate

Characters
0
Characters without spaces
0
Words
0
Lines
0
Bytes (UTF-8)
0
Characters per token
0
Tokens per word
0

API cost calculator

The number of tokens the model writes back. Reasoning models also bill their thinking as output.

The share of each prompt read from the cache, such as a long system prompt you resend.

Cost per request
$0.00
Input
$0.00
Output
$0.00
Per 1,000 requests
$0.00
Per day
$0.00
Per month
$0.00

Compare tokens and cost across AI models

Token count and API cost per model for your text. Select a model name to use it above.
See how your text splits into tokens

How accurate is this token calculator?

OpenAI models: exact. GPT-5, GPT-4.1, GPT-4o and the o-series use the o200k_base tokenizer, and GPT-4 and GPT-3.5 use cl100k_base. This tool runs both in your browser and matched OpenAI's own tiktoken library token for token on 460 test texts each, including code, JSON, emoji and 8 languages.

GPT-6: very likely exact. OpenAI has not published the GPT-6 tokenizer, so the tool shows the o200k_base count used by every GPT-5 model.

Claude and Gemini: exact on request. Anthropic and Google do not publish their tokenizers. The tool shows an estimate first. The exact count button sends your text to the provider's free token counting service, which returns the real number. The text is not stored. Claude needs noticeably more tokens than GPT for the same text: the sample text on this page is 137 tokens with o200k_base and 197 tokens on Claude Sonnet 5.5. Anthropic says Claude models from Opus 4.7 onward use about 30% more tokens than earlier Claude models.

Grok, DeepSeek and Mistral: estimates. The estimate scales the exact o200k count by a ratio for each writing system. For DeepSeek and Mistral, the ratios were measured with their published tokenizers: close to 1 for English and code, about 2.2 for Hindi, and 0.76 (DeepSeek) to 1.26 (Mistral) for Chinese.

Chat requests. Paste a messages array and the tool adds the formatting tokens each message costs (OpenAI: about 3 per message plus 3 for the reply).

AI model API prices per 1M tokens

Standard prices in US dollars, checked on 22 October 2026 on each provider's official pricing page. Batch, regional and priority prices differ.

Model Input Cached input Output Context Tokenizer and notes
OpenAI
GPT-6.1 Sol
gpt-6.1-sol
$2.00 $0.10 $10.00 1.05M o200k_base (assumed). Over 272K input tokens: $4.00 input, $15.00 output
GPT-6 Astra
gpt-6-astra
$10.00 $1.00 $50.00 1.05M o200k_base (assumed). Over 272K input tokens: $20.00 input, $75.00 output
GPT-6 Luna
gpt-6-luna
$0.10 $0.01 $0.50 1.05M o200k_base (assumed). Over 272K input tokens: $0.20 input, $0.75 output
GPT-5.6 Sol
gpt-5.6-sol
$4.00 $0.40 $20.00 1.05M o200k_base (exact). Over 272K input tokens: $8.00 input, $30.00 output. Promotional price, offered at least until 21 November 2026.
GPT-5.6 Terra
gpt-5.6-terra
$2.00 $0.20 $12.00 1.05M o200k_base (exact). Over 272K input tokens: $4.00 input, $18.00 output
GPT-5.6 Luna
gpt-5.6-luna
$0.20 $0.02 $1.20 1.05M o200k_base (exact). Over 272K input tokens: $0.40 input, $1.80 output
GPT-5.5
gpt-5.5
$5.00 $0.50 $30.00 1.05M o200k_base (exact). Over 272K input tokens: $10.00 input, $45.00 output
GPT-5.4
gpt-5.4
$2.50 $0.25 $15.00 1.05M o200k_base (exact). Over 272K input tokens: $5.00 input, $22.50 output
GPT-5.4 mini
gpt-5.4-mini
$0.75 $0.075 $4.50 400K o200k_base (exact)
GPT-5.4 nano
gpt-5.4-nano
$0.20 $0.02 $1.25 400K o200k_base (exact). OpenAI shuts this model down on 1 April 2027.
Anthropic
Claude Sonnet 5.5
claude-sonnet-5-5
$2.00 $0.10 $10.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Opus 5.5
claude-opus-5-5
$4.00 $0.20 $20.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Fable 5.1
claude-fable-5-1
$10.00 $0.25 $50.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Haiku 5.5
claude-haiku-5-5
$0.10 $0.01 $0.50 1M Claude Haiku 5.5 tokenizer. Over 100K input tokens: $0.50 input, $2.50 output
Google
Gemini 4 Argon
gemini-4-argon
$2.00 $0.10 $10.00 1.05M Gemini tokenizer. Google raises this to $4 input, $0.20 cached and $20 output on 1 December 2026.
Gemini 3.8 Flash
gemini-3.8-flash
$0.75 $0.075 $3.75 1.05M Gemini tokenizer. Google doubles this price on 1 January 2027 ($1.50 input, $7.50 output).
Gemini 3.5 Flash-Lite
gemini-3.5-flash-lite
$0.30 $0.03 $2.50 1.05M Gemini tokenizer
Gemini 3.1 Flash-Lite
gemini-3.1-flash-lite
$0.25 $0.025 $1.50 1.05M Gemini tokenizer
Gemini 3.1 Pro Preview
gemini-3.1-pro-preview
$2.00 $0.20 $12.00 1.05M Gemini tokenizer. Over 200K input tokens: $4.00 input, $18.00 output
xAI
Grok 4.7
grok-4.7
$2.00 $0.50 $6.00 500K Grok tokenizer. Over 200K input tokens: $4.00 input, $12.00 output
Grok 4.3
grok-4.3
$1.25 $0.20 $2.50 1M Grok tokenizer. Over 200K input tokens: $2.50 input, $5.00 output
Grok Build 0.1
grok-build-0.1
$1.00 $0.20 $2.00 256K Grok tokenizer. Over 200K input tokens: $2.00 input, $4.00 output
DeepSeek
DeepSeek V4.1 Flash
deepseek-flash
$0.30 $0.006 $1.20 1M DeepSeek V4 tokenizer. Peak price. DeepSeek charges half outside 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday to Friday.
DeepSeek V4 Pro
deepseek-v4-pro
$1.32 $0.044 $3.96 1M DeepSeek V4 tokenizer. Peak price. DeepSeek charges half outside 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday to Friday.
Mistral AI
Mistral Large 3
mistral-large-2512
$0.50 - $1.50 256K Mistral Tekken tokenizer
Mistral Medium 3.5
mistral-medium-3-5
$1.50 $0.15 $7.50 256K Mistral Tekken tokenizer. Price updated on 22 October 2026
Mistral Small 4
mistral-small-2603
$0.15 - $0.60 256K Mistral Tekken tokenizer
Mistral Large 4 (preview)
mistral-large-4
$0.68 $0.068 $2.09 1M Mistral Tekken tokenizer. Public preview.. Price updated on 22 October 2026
Older models still on sale
Model Input Cached input Output Context Tokenizer and notes
OpenAI
GPT-6 Sol
gpt-6-sol
$2.00 $0.20 $10.00 1.05M o200k_base (assumed). Over 272K input tokens: $4.00 input, $15.00 output
GPT-5.2
gpt-5.2
$1.75 $0.175 $14.00 400K o200k_base (exact)
GPT-5
gpt-5
$1.25 $0.125 $10.00 400K o200k_base (exact). OpenAI shuts this model down on 11 December 2026.
GPT-5 mini
gpt-5-mini
$0.25 $0.025 $2.00 400K o200k_base (exact). OpenAI shuts this model down on 11 December 2026.
GPT-5 nano
gpt-5-nano
$0.05 $0.005 $0.40 400K o200k_base (exact). OpenAI shuts this model down on 11 December 2026.
GPT-4.1
gpt-4.1
$2.00 $0.50 $8.00 1.05M o200k_base (exact). OpenAI shuts this model down on 14 January 2027.
GPT-4.1 mini
gpt-4.1-mini
$0.40 $0.10 $1.60 1.05M o200k_base (exact). OpenAI shuts this model down on 14 January 2027.
GPT-4.1 nano
gpt-4.1-nano
$0.10 $0.025 $0.40 1.05M o200k_base (exact)
GPT-4o
gpt-4o
$2.50 $1.25 $10.00 128K o200k_base (exact). OpenAI shuts this model down on 14 January 2027.
GPT-4o mini
gpt-4o-mini
$0.15 $0.075 $0.60 128K o200k_base (exact). OpenAI shuts this model down on 14 January 2027.
o4-mini
o4-mini
$1.10 $0.275 $4.40 200K o200k_base (exact)
o3
o3
$2.00 $0.50 $8.00 200K o200k_base (exact). OpenAI shuts this model down on 11 December 2026.
GPT-4 Turbo
gpt-4-turbo-2024-04-09
$10.00 - $30.00 128K cl100k_base (exact)
GPT-4
gpt-4-0613
$30.00 - $60.00 8.2K cl100k_base (exact)
Anthropic
Claude Sonnet 5
claude-sonnet-5
$2.00 $0.20 $10.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Opus 5
claude-opus-5
$5.00 $0.50 $25.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Fable 5
claude-fable-5
$10.00 $1.00 $50.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Opus 4.8
claude-opus-4-8
$5.00 $0.50 $25.00 1M Claude tokenizer (Opus 4.7 and later, Sonnet 5 and later)
Claude Sonnet 4.6
claude-sonnet-4-6
$3.00 $0.30 $15.00 1M Claude tokenizer (Sonnet 4.6, Haiku 4.5)
Claude Haiku 4.5
claude-haiku-4-5
$1.00 $0.10 $5.00 200K Claude tokenizer (Sonnet 4.6, Haiku 4.5)
Google
Gemini 3.6 Flash
gemini-3.6-flash
$0.75 $0.075 $3.75 1.05M Gemini tokenizer. Google doubles this price on 1 January 2027 ($1.50 input, $7.50 output).
Gemini 3 Flash Preview
gemini-3-flash-preview
$0.50 $0.05 $3.00 1.05M Gemini tokenizer
Gemini 2.5 Pro
gemini-2.5-pro
$1.25 $0.125 $10.00 1.05M Gemini tokenizer. Over 200K input tokens: $2.50 input, $15.00 output
Gemini 2.5 Flash
gemini-2.5-flash
$0.30 $0.03 $2.50 1.05M Gemini tokenizer
Gemini 2.5 Flash-Lite
gemini-2.5-flash-lite
$0.10 $0.01 $0.40 1.05M Gemini tokenizer

How many words is a token?

For English text, OpenAI puts one token at about 4 characters or 0.75 words. Anthropic says its current Claude models use about 30% more tokens for the same text, and Google puts 100 Gemini tokens at about 60 to 80 English words. Other languages, code and numbers use more tokens per word.

Tokens About this many English words About this many characters
1 0.75 4
100 75 400
1,000 750 4,000
10,000 7,500 40,000
100,000 75,000 400,000
1,000,000 750,000 4,000,000

A token calculator counts how many tokens your text uses in an AI model and turns that count into an API cost. Paste a prompt, a chat request or a file, pick a model from GPT, Claude, Gemini, Grok, DeepSeek or Mistral, and see your token count, context window use and the price per request and per month.

What Is a Token in AI, and What Is Tokenization?

A token is the small chunk of text an AI model reads and writes, and tokenization is the step that splits your text into those chunks. A token can be a whole short word, part of a long word, a number, a punctuation mark or a line break.

Models do not see letters or words. They see a list of token IDs, and every limit and price is based on that list. Your context window is measured in tokens, and API providers bill per million tokens.

For ordinary English, a widely used rule of thumb is that one token is about four characters, or about three quarters of a word. So 1,000 words come to roughly 1,300 tokens. Code, tables, URLs, emoji and languages such as Chinese, Japanese or Arabic usually split into more tokens per word, so the same idea can cost more.

Each model family has its own tokenizer, so the same text gives slightly different counts in different models. This is why a single rule of thumb is useful for planning, but a real count is better for budgeting.

How to Use the Token Calculator

You can get a token count and a cost estimate in a few steps, and you do not need an account to try it.

  1. Type or paste your text into the box labeled Your text, prompt or chat request (JSON). You can also use Paste, press Sample to load an example, or upload a file. Supported files include text, Markdown, CSV, JSON, code and .docx, up to 20 MB.
  2. If you pasted a messages array from OpenAI, Claude or Gemini, keep Count it as a chat request checked. The count then includes the formatting tokens each message adds. Uncheck it to count the raw text only.
  3. Choose a model in the AI model list. Models are grouped by provider, and Include older models adds models that are still on sale but no longer current.
  4. Check the Token count and the Context window used bar to see how much of the model's limit your text fills.
  5. In the cost section, leave Input tokens per request on Use the tokens of my text, or type your own number. Set Output tokens per request manually, choose Same as input (rewrites, translations), or use the typical reply lengths shown.
  6. Enter the Number of requests and switch the period between per month and per day. Add a Cached input (prompt caching), % value if part of your prompt repeats, and tick Batch API if you plan to use batch pricing.
  7. Read the comparison table. It lists each model with its tokens, cost per request, cost for your chosen period and context size, and you can sort it or limit it with Providers to compare.

Worked Example: Estimating a Monthly Bill

Say you run a support assistant that sends the same 1,500-word help article plus a customer question with every request. That is about 2,000 input tokens per request, and you expect replies of about 500 tokens. You expect 10,000 requests a month.

For the math, assume a model priced at $2 per 1M input tokens and $8 per 1M output tokens. These prices are only an example, so check the live prices in the table for the model you choose.

  • Input: 2,000 tokens × 10,000 requests = 20,000,000 tokens, which is 20 × $2 = $40.
  • Output: 500 tokens × 10,000 requests = 5,000,000 tokens, which is 5 × $8 = $40.
  • Total: about $80 per month, or $0.008 per request.

Now suppose the 1,500-word article is the same in every call. If you set Cached input (prompt caching), % to a high share, the cached part is billed at the lower cached-input rate shown in the price table, and the monthly figure drops. Output tokens often cost several times more than input tokens, so a long reply can cost more than a long prompt.

How Do You Read and Act on the Results?

Each result answers one planning question: does the text fit, what does it cost, and which model is the best value for the job.

Token count and the exact or estimate badge

The big number is the token count for the selected model. A badge tells you whether it is an exact count or an estimate. Use exact counts for tight limits, and treat estimates as a planning figure with a small margin of error.

Context window used

The bar shows your tokens as a share of the model's context window. Below about 70% you have comfortable room. Once the bar turns amber, you may leave too little space for the reply. A red bar means the text is over the limit and must be shortened or split. Remember that the model's answer also uses the same window, so leave space for output.

Cost per request and per month

Cost per request is useful for comparing prompts. Cost for the period is useful for budgets. If the monthly number is higher than you expected, try these fixes in order:

  • Trim repeated instructions and long examples from the prompt.
  • Move stable text to the front so caching applies, then raise the cached share.
  • Cap the reply length so you do not pay for output you do not use.
  • Use batch pricing for work that does not need an instant answer.
  • Compare a smaller model in the table and test whether its quality is enough.

Words, characters and the words-per-token ratio

The tool also shows characters and words, plus a quick answer to How many words is a token? for your own text. A ratio far from the usual 0.75 words per token is a hint that your text has a lot of code, numbers or non-English content.

How Can You See How Your Text Splits Into Tokens?

The section See how your text splits into tokens shows your text with each token highlighted in alternating colors. Choose a Tokenizer: o200k_base is used by GPT-5, GPT-4.1, GPT-4o and the o-series, and cl100k_base is used by GPT-4, GPT-4 Turbo and GPT-3.5.

Turn on Show spaces and line breaks to see that a leading space is often part of a token. Turn on Show token IDs to see the number the model actually receives. This view explains surprises, such as why an unusual product name takes five tokens while a common word takes one.

Who Is a Token Calculator For?

It helps anyone who writes prompts or pays for AI usage, and it saves guessing before you send a request.

  • Developers check that a prompt and its documents fit inside a context window before an API call fails.
  • Product teams forecast a monthly bill for a chatbot, summarizer or translation feature before launch.
  • Content and SEO teams estimate the cost of rewriting or summarizing hundreds of pages in bulk.
  • Prompt engineers measure how much shorter a rewritten prompt really is.
  • Analysts compare providers side by side for the same workload using the same inputs.

Best Practices, Common Mistakes and Troubleshooting

Most wrong estimates come from a few predictable input mistakes, and each has a simple fix.

  • Forgetting the output. Cost depends on input and output. If you only count the prompt, your bill will look too low. Set a realistic output size.
  • Ignoring chat overhead. A conversation adds formatting tokens to every message. Paste the full messages array and keep Count it as a chat request checked.
  • Counting only one turn. In a multi-turn chat, earlier messages are sent again with each new request. Enter the full history size as your input tokens.
  • Using the wrong tokenizer. If you compare GPT counts, make sure the tokenizer matches the model generation.
  • Pasting JSON that is not a messages array. If your JSON is data and not a chat, uncheck the chat option so it is counted as plain text.
  • Hidden text in files. A .docx or HTML file can contain more text than you see on screen. Check the character count when a number looks too high.
  • Old prices. Providers change prices. Look at the Prices checked note and confirm against the provider before signing off a budget.

How Accurate Is This Token Calculator?

OpenAI counts use the real tokenizers and are exact for the models that share them. For Claude, Gemini, Grok, DeepSeek and Mistral, a count may be an estimate scaled from the GPT count, and the badge says so. Estimates are good for budgeting, but they can differ from the provider's own figure by a few percent.

For very large texts, above 200,000 characters, the character and word counts use a faster method and can differ slightly from a word processor. Prices and context sizes are a snapshot, so they can lag behind a provider's announcement. Finally, a token count is not a quality measure, and a cheaper model is only a better choice if it still does the job.

Paste your own prompt or load the sample in the calculator above, pick a model, and you will see your token count and cost in seconds. Then adjust the output size, request volume and caching to see what your real bill could look like.

Frequently Asked Questions

How to calculate tokens from text?
Paste your text into the token calculator, choose an AI model, and read the Token count. For a quick manual estimate, divide the number of characters by four, or multiply English words by about 1.3. A 1,000-word article is roughly 1,300 tokens.
What is a token in AI?
A token is a small piece of text, such as a short word, part of a longer word, a number or a punctuation mark, that an AI model reads and writes. Context limits and API prices are measured in tokens, so counting them tells you what fits and what it costs.
How to calculate token cost for an API request?
Multiply input tokens by the input price and output tokens by the output price, both per million tokens, then add them. The calculator does this for you from your text, your output size and the number of requests per day or month.
How to calculate token usage in Claude?
Select a Claude model in the AI model list and paste your prompt or messages array. The tool shows the token count and cost, and a badge tells you whether the number is exact or an estimate. Claude counts may be estimates, so leave a small safety margin.
Is this token calculator accurate?
OpenAI counts are exact for models that use the o200k_base or cl100k_base tokenizers. Counts for other providers can be estimates, marked with a badge, and may differ from the provider by a few percent. Use them for budgeting and planning.
Is the token calculator free, and what files can I upload?
Yes, the token calculator is free and needs no sign-in. You can type, paste or drop text, or upload text, Markdown, CSV, JSON, code or .docx files up to 20 MB. If a file looks too large, count a smaller section.
Recommended

Explore VPN options

A VPN changes your network exit. It does not guarantee anonymity.

Hide Your IP Encryption Network coverage
Protect My IP Now