AI Token Calculator

Count tokens and estimate API costs for ChatGPT, Claude, Gemini, DeepSeek, Grok, Qwen, Mistral & Meta LLaMA — instantly, privately, in your browser.Count tokens & estimate API costs for 20+ AI models. Free, instant, private.

OpenAI
Anthropic
Google
DeepSeek
Meta
Mistral
0 chars
0
Tokens
0
Words
0
Chars
$0.00
Input Cost
Context: 0 / 272.0K tokens(0.0%)
INPUT$0.0000
OUTPUT+$0.0000 (EST)
TOTAL$0.00000
🎨Token Visualizer
Type text above to see tokenization…

Cost Estimate by Provider

Based on your current token count — pick a model per provider and compare side by side.

OpenAI
Input$0.00
Cached Input$0.00
Output$0.00
EST. TOTAL$0.00
Anthropic
Input$0.00
Cached Input$0.00
Cache Write (5-min)$0.00
Cache Write (1-hr)$0.00
Output$0.00
EST. TOTAL$0.00
Google
Input$0.00
Cached Input$0.00
Output$0.00
EST. TOTAL$0.00
DeepSeek
Input$0.00
Cached Input$0.00
Output$0.00
EST. TOTAL$0.00
Meta
Input$0.00
Output$0.00
EST. TOTAL$0.00
Mistral
Input$0.00
Output$0.00
EST. TOTAL$0.00
Perplexity
Input$0.00
Output$0.00
EST. TOTAL$0.00
xAI
Input$0.00
Output$0.00
EST. TOTAL$0.00
Qwen
Input$0.00
Output$0.00
EST. TOTAL$0.00

💰 MONTHLY COST PROJECTOR

Requests/day1.0K
Input tokens1.0K
Output tokens500
ModelMonthly costAnnual cost
Llama 4 Scout$8.40$100.80
GPT-4.1 Nano$9.00$108.00
Gemini 2.5 Flash-Lite$9.00$108.00
GPT-4o Mini$13.50$162.00
DeepSeek V3$14.70$176.40
Llama 4 Maverick$15.00$180.00
GPT-4.1 Mini$36.00$432.00
Gemini 2.5 Flash$46.50$558.00
DeepSeek R1$49.35$592.20
o4-mini$99.00$1188.00
Claude Haiku 4.5$105.00$1260.00
Gemini 1.5 Pro$112.50$1350.00
GPT-4.1$180.00$2160.00
o3$180.00$2160.00
Gemini 2.5 Pro$187.50$2250.00
GPT-4o$225.00$2700.00
Claude Sonnet 4.6$315.00$3780.00
Claude Opus 4.7$525.00$6300.00
Claude Opus 4.6$525.00$6300.00
o3-pro$1800.00$21600.00

* Multiply monthly cost ×12 for annual estimate

Best value for this usage: Llama 4 Scout ($8.40/mo)

💰 LLM API Pricing per 1M Tokens

ModelProviderContextInput / 1MOutput / 1M
Ministral 3BMistral128K$0.040$0.04
GPT-5 NanoOpenAI200K$0.050$0.40
Gemini 1.5 FlashGoogle1M$0.075$0.30
GPT-4.1 NanoOpenAI1.0M$0.10$0.40
Gemini 2.5 Flash-LiteGoogle1M$0.10$0.40
Gemini 2.0 FlashGoogle1M$0.10$0.40
Ministral 8BMistral128K$0.10$0.10
Mistral Small 3Mistral32K$0.10$0.30
Llama 4 ScoutMeta10M$0.11$0.34
GPT-4o MiniOpenAI128K$0.15$0.60
Mistral NemoMistral128K$0.15$0.15
Pixtral 12BMistral128K$0.15$0.15
Grok 4.1 FastxAI2M$0.20$0.50
Llama 4 MaverickMeta1M$0.20$0.60
GPT-5.4 NanoOpenAI272K$0.20$1.25
CodestralMistral256K$0.20$0.60
Sonar SmallPerplexity127K$0.20$0.20
Qwen 2.5 72BQwen131K$0.23$0.40
Gemini 3.1 Flash-LiteGoogle1M$0.25$1.50
GPT-5 MiniOpenAI200K$0.25$2.00
Claude Haiku 3Anthropic200K$0.25$1.25
DeepSeek V3DeepSeek128K$0.28$0.42
Gemini 2.5 FlashGoogle1M$0.30$2.50
GPT-4.1 MiniOpenAI1.0M$0.40$1.60
Gemini 3 FlashGoogle2M$0.50$3.00
Qwen 3.5 PlusQwen1M$0.50$2.00
GPT-3.5 TurboOpenAI16K$0.50$1.50
DeepSeek R1DeepSeek128K$0.55$2.19
LLaMA 3.3 70BMeta131K$0.59$0.79
GPT-5.4 MiniOpenAI272K$0.75$4.50
Claude Haiku 3.5Anthropic200K$0.80$4.00
Claude Haiku 4.5Anthropic200K$1.00$5.00
Sonar LargePerplexity127K$1.00$1.00
o4-miniOpenAI200K$1.10$4.40
o3-miniOpenAI200K$1.10$4.40
o1-miniOpenAI200K$1.10$4.40
Gemini 2.5 ProGoogle2M$1.25$10.00
Gemini 1.5 ProGoogle2M$1.25$5.00
Grok 4.20xAI2M$1.25$2.50
Grok 4.3xAI1M$1.25$2.50
GPT-5.1OpenAI200K$1.25$10.00
GPT-5OpenAI200K$1.25$10.00
GPT-5.2OpenAI200K$1.75$14.00
Gemini 3.1 ProGoogle2M$2.00$12.00
GPT-4.1OpenAI1.0M$2.00$8.00
o3OpenAI200K$2.00$8.00
Mistral Large 3Mistral128K$2.00$6.00
Pixtral LargeMistral128K$2.00$6.00
Qwen 3.7 MaxQwen1M$2.50$7.50
GPT-5.4OpenAI272K$2.50$15.00
GPT-4oOpenAI128K$2.50$10.00
Claude Sonnet 4.6Anthropic1M$3.00$15.00
Claude Sonnet 4.5Anthropic200K$3.00$15.00
Claude Sonnet 4Anthropic200K$3.00$15.00
Claude Sonnet 3.7Anthropic200K$3.00$15.00
Sonar ProPerplexity200K$3.00$15.00
Claude Opus 4.7Anthropic1M$5.00$25.00
Claude Opus 4.6Anthropic1M$5.00$25.00
Claude Opus 4.5Anthropic200K$5.00$25.00
Sonar HugePerplexity127K$5.00$5.00
GPT-5 ProOpenAI200K$15.00$120.00
o1OpenAI200K$15.00$60.00
Claude Opus 4.1Anthropic200K$15.00$75.00
Claude Opus 4Anthropic200K$15.00$75.00
Claude Opus 3Anthropic200K$15.00$75.00
o3-proOpenAI200K$20.00$80.00
GPT-5.2 ProOpenAI200K$21.00$168.00
GPT-5.4 ProOpenAI272K$30.00$180.00
o1-proOpenAI200K$150.00$600.00
Ministral 3BMistral
Input$0.040/1M tokens
Output$0.04/1M tokens
Context128Ktokens
GPT-5 NanoOpenAI
Input$0.050/1M tokens
Output$0.40/1M tokens
Context200Ktokens
Gemini 1.5 FlashGoogle
Input$0.075/1M tokens
Output$0.30/1M tokens
Context1Mtokens
GPT-4.1 NanoOpenAI
Input$0.10/1M tokens
Output$0.40/1M tokens
Context1.0Mtokens
Gemini 2.5 Flash-LiteGoogle
Input$0.10/1M tokens
Output$0.40/1M tokens
Context1Mtokens
Gemini 2.0 FlashGoogle
Input$0.10/1M tokens
Output$0.40/1M tokens
Context1Mtokens
Ministral 8BMistral
Input$0.10/1M tokens
Output$0.10/1M tokens
Context128Ktokens
Mistral Small 3Mistral
Input$0.10/1M tokens
Output$0.30/1M tokens
Context32Ktokens
Llama 4 ScoutMeta
Input$0.11/1M tokens
Output$0.34/1M tokens
Context10Mtokens
GPT-4o MiniOpenAI
Input$0.15/1M tokens
Output$0.60/1M tokens
Context128Ktokens
Mistral NemoMistral
Input$0.15/1M tokens
Output$0.15/1M tokens
Context128Ktokens
Pixtral 12BMistral
Input$0.15/1M tokens
Output$0.15/1M tokens
Context128Ktokens
Grok 4.1 FastxAI
Input$0.20/1M tokens
Output$0.50/1M tokens
Context2Mtokens
Llama 4 MaverickMeta
Input$0.20/1M tokens
Output$0.60/1M tokens
Context1Mtokens
GPT-5.4 NanoOpenAI
Input$0.20/1M tokens
Output$1.25/1M tokens
Context272Ktokens
CodestralMistral
Input$0.20/1M tokens
Output$0.60/1M tokens
Context256Ktokens
Sonar SmallPerplexity
Input$0.20/1M tokens
Output$0.20/1M tokens
Context127Ktokens
Qwen 2.5 72BQwen
Input$0.23/1M tokens
Output$0.40/1M tokens
Context131Ktokens
Gemini 3.1 Flash-LiteGoogle
Input$0.25/1M tokens
Output$1.50/1M tokens
Context1Mtokens
GPT-5 MiniOpenAI
Input$0.25/1M tokens
Output$2.00/1M tokens
Context200Ktokens
Claude Haiku 3Anthropic
Input$0.25/1M tokens
Output$1.25/1M tokens
Context200Ktokens
DeepSeek V3DeepSeek
Input$0.28/1M tokens
Output$0.42/1M tokens
Context128Ktokens
Gemini 2.5 FlashGoogle
Input$0.30/1M tokens
Output$2.50/1M tokens
Context1Mtokens
GPT-4.1 MiniOpenAI
Input$0.40/1M tokens
Output$1.60/1M tokens
Context1.0Mtokens
Gemini 3 FlashGoogle
Input$0.50/1M tokens
Output$3.00/1M tokens
Context2Mtokens
Qwen 3.5 PlusQwen
Input$0.50/1M tokens
Output$2.00/1M tokens
Context1Mtokens
GPT-3.5 TurboOpenAI
Input$0.50/1M tokens
Output$1.50/1M tokens
Context16Ktokens
DeepSeek R1DeepSeek
Input$0.55/1M tokens
Output$2.19/1M tokens
Context128Ktokens
LLaMA 3.3 70BMeta
Input$0.59/1M tokens
Output$0.79/1M tokens
Context131Ktokens
GPT-5.4 MiniOpenAI
Input$0.75/1M tokens
Output$4.50/1M tokens
Context272Ktokens
Claude Haiku 3.5Anthropic
Input$0.80/1M tokens
Output$4.00/1M tokens
Context200Ktokens
Claude Haiku 4.5Anthropic
Input$1.00/1M tokens
Output$5.00/1M tokens
Context200Ktokens
Sonar LargePerplexity
Input$1.00/1M tokens
Output$1.00/1M tokens
Context127Ktokens
o4-miniOpenAI
Input$1.10/1M tokens
Output$4.40/1M tokens
Context200Ktokens
o3-miniOpenAI
Input$1.10/1M tokens
Output$4.40/1M tokens
Context200Ktokens
o1-miniOpenAI
Input$1.10/1M tokens
Output$4.40/1M tokens
Context200Ktokens
Gemini 2.5 ProGoogle
Input$1.25/1M tokens
Output$10.00/1M tokens
Context2Mtokens
Gemini 1.5 ProGoogle
Input$1.25/1M tokens
Output$5.00/1M tokens
Context2Mtokens
Grok 4.20xAI
Input$1.25/1M tokens
Output$2.50/1M tokens
Context2Mtokens
Grok 4.3xAI
Input$1.25/1M tokens
Output$2.50/1M tokens
Context1Mtokens
GPT-5.1OpenAI
Input$1.25/1M tokens
Output$10.00/1M tokens
Context200Ktokens
GPT-5OpenAI
Input$1.25/1M tokens
Output$10.00/1M tokens
Context200Ktokens
GPT-5.2OpenAI
Input$1.75/1M tokens
Output$14.00/1M tokens
Context200Ktokens
Gemini 3.1 ProGoogle
Input$2.00/1M tokens
Output$12.00/1M tokens
Context2Mtokens
GPT-4.1OpenAI
Input$2.00/1M tokens
Output$8.00/1M tokens
Context1.0Mtokens
o3OpenAI
Input$2.00/1M tokens
Output$8.00/1M tokens
Context200Ktokens
Mistral Large 3Mistral
Input$2.00/1M tokens
Output$6.00/1M tokens
Context128Ktokens
Pixtral LargeMistral
Input$2.00/1M tokens
Output$6.00/1M tokens
Context128Ktokens
Qwen 3.7 MaxQwen
Input$2.50/1M tokens
Output$7.50/1M tokens
Context1Mtokens
GPT-5.4OpenAI
Input$2.50/1M tokens
Output$15.00/1M tokens
Context272Ktokens
GPT-4oOpenAI
Input$2.50/1M tokens
Output$10.00/1M tokens
Context128Ktokens
Claude Sonnet 4.6Anthropic
Input$3.00/1M tokens
Output$15.00/1M tokens
Context1Mtokens
Claude Sonnet 4.5Anthropic
Input$3.00/1M tokens
Output$15.00/1M tokens
Context200Ktokens
Claude Sonnet 4Anthropic
Input$3.00/1M tokens
Output$15.00/1M tokens
Context200Ktokens
Claude Sonnet 3.7Anthropic
Input$3.00/1M tokens
Output$15.00/1M tokens
Context200Ktokens
Sonar ProPerplexity
Input$3.00/1M tokens
Output$15.00/1M tokens
Context200Ktokens
Claude Opus 4.7Anthropic
Input$5.00/1M tokens
Output$25.00/1M tokens
Context1Mtokens
Claude Opus 4.6Anthropic
Input$5.00/1M tokens
Output$25.00/1M tokens
Context1Mtokens
Claude Opus 4.5Anthropic
Input$5.00/1M tokens
Output$25.00/1M tokens
Context200Ktokens
Sonar HugePerplexity
Input$5.00/1M tokens
Output$5.00/1M tokens
Context127Ktokens
GPT-5 ProOpenAI
Input$15.00/1M tokens
Output$120.00/1M tokens
Context200Ktokens
o1OpenAI
Input$15.00/1M tokens
Output$60.00/1M tokens
Context200Ktokens
Claude Opus 4.1Anthropic
Input$15.00/1M tokens
Output$75.00/1M tokens
Context200Ktokens
Claude Opus 4Anthropic
Input$15.00/1M tokens
Output$75.00/1M tokens
Context200Ktokens
Claude Opus 3Anthropic
Input$15.00/1M tokens
Output$75.00/1M tokens
Context200Ktokens
o3-proOpenAI
Input$20.00/1M tokens
Output$80.00/1M tokens
Context200Ktokens
GPT-5.2 ProOpenAI
Input$21.00/1M tokens
Output$168.00/1M tokens
Context200Ktokens
GPT-5.4 ProOpenAI
Input$30.00/1M tokens
Output$180.00/1M tokens
Context272Ktokens
o1-proOpenAI
Input$150.00/1M tokens
Output$600.00/1M tokens
Context200Ktokens
Providers:
OpenAI
Anthropic
Google
DeepSeek
Meta
Mistral
Price Groupings (Input):
$0.00 ≤ $0.50 (Budget)
$1.00 Mid-range
$5.00 ≥ $5.00 (Premium)

Understanding Tokenization

This tool functions as a universal tokenizer for OpenAI, Anthropic, and Google models. We use official Tiktoken libraries and model-specific tokenizers for 99% accuracy in token counting. Use this tokenizer to verify your prompt token counts before making API calls.

What is BPE (Byte-Pair Encoding)?

BPE is the tokenization algorithm used by GPT models. It breaks text into subword units by iteratively merging the most frequent character pairs. For example, "tokenization" might become ["token", "ization"]. This allows models to handle rare words efficiently while keeping vocabulary size manageable.

What is a Context Window?

The context window is the maximum number of tokens an LLM can process in a single request (input + output combined). GPT-4o offers 128K tokens, Claude 3.5 provides 200K tokens, and Gemini 1.5 Pro supports up to 2M tokens. Exceeding this limit will cause truncation or errors.

What is Cached Input Pricing?

Cached input pricing offers significant discounts (up to 90% off) when you reuse the same prompt prefix across multiple API calls. This is ideal for system prompts, few-shot examples, or document analysis where the context remains constant while only the query changes.

Input vs Output Token Costs

Output tokens are typically 2-4x more expensive than input tokens because they require the model to perform sequential generation. To optimize costs, design prompts that get concise responses, use output length limits, and choose the right model for each task.

Word-to-Token Conversion Guide

Token counts vary significantly based on content type and language. Use this reference to estimate token usage before running your text through the calculator.

Content TypeExampleRatio1000 Words ≈Notes
English TextHello world~1.3 tokens/word~1,300-1,500Standard prose averages 1.3 tokens per word
Code (Python/JS)def func():~2-3 tokens/word~2,000-3,000Symbols, operators, and syntax increase token count
Chinese/Japanese你好世界~2+ tokens/char~2,000+CJK characters often split into multiple tokens
Technical WritingAPI endpoint~1.5 tokens/word~1,500-1,800Technical terms and abbreviations vary
JSON/XML Data{"key":"value"}~3-4 tokens/word~3,000-4,000Structural characters add significant overhead

How It Works

01
📝

Paste your text

Type or paste any text — a system prompt, user message, or full conversation. The calculator tokenizes in real time as you type.

02
🤖

Select your model

Choose from GPT-4o, Claude, Gemini, DeepSeek and 20+ models. Each uses a different tokenizer — the same text can cost 2× more on different models.

03
💰

See tokens + cost

Instantly see exact token count, estimated API cost, and how close you are to the context window limit. No signup, no API key required.

How Does AI Token Counting Work?

AI models like GPT-4o, Claude, and Gemini don't read text the way humans do. Instead, they use a tokenizer to break text into tokens — small chunks that can be whole words, word pieces, or even individual characters. The word “tokenization” becomes three tokens: “token”, “ization” — while common words like “the” are single tokens.

This matters because API pricing is based on token count, not word count. Our token calculator uses the same tiktoken library that OpenAI uses internally, running entirely in your browser via WebAssembly — so your text is never sent to any server.

Use the Token Visualizer above to see exactly how your text is split into tokens. Each colored chip represents one token — tap or hover over any chip to see its token ID. Compare token counts across different models to find the most cost-effective option for your use case.

❓ Common Questions

🔍
What is a token in AI and large language models?
A token is the basic unit of text that AI models like GPT-4o, Claude, and Gemini process. Tokens can be whole words, parts of words, or individual characters. In English, 1 token is roughly 4 characters or about 0.75 words. The word 'tokenization' becomes 3 tokens: 'token', 'ization'. API pricing is charged per token, not per word or character.
Did this answer your question?
What are the newest AI models available in 2026?
The newest models in 2026 include: GPT-4.1, GPT-4.1 Mini, and GPT-4.1 Nano from OpenAI (with 1M token context windows); Claude Opus 4.7 and Claude Haiku 4.5 from Anthropic; Gemini 2.5 Pro and Gemini 2.5 Flash from Google; Llama 4 Scout and Llama 4 Maverick from Meta; and DeepSeek V3-0324. Our calculator supports all of these models.
Did this answer your question?
How does this token calculator work?
This calculator uses the same tiktoken library that OpenAI uses internally, running entirely in your browser via WebAssembly. When you type or paste text, it tokenizes instantly with zero API calls — your text never leaves your device. The token count, word count, character count, and estimated cost are calculated in real time.
Did this answer your question?
Why do different AI models produce different token counts?
Each model uses a different tokenizer with a different vocabulary size. GPT-4o uses o200k_base (200K vocab), GPT-3.5 uses cl100k_base (100K vocab), Claude uses Anthropic's custom BPE, and Gemini uses SentencePiece. A larger vocabulary means common words are single tokens, making text more compact. The same sentence can produce different token counts on each model, directly affecting API cost.
Did this answer your question?
How much does it cost to use GPT-4o, Claude, or Gemini?
As of April 2026: GPT-4.1 costs $2.00/1M input tokens and $8.00/1M output tokens. Claude Sonnet 4.6 costs $3/$15 per 1M tokens. Gemini 2.5 Pro costs $1.25/$10 per 1M tokens. For budget options: GPT-4.1 Nano ($0.10/$0.40), Gemini 2.5 Flash-Lite ($0.10/$0.40), and Mistral Small ($0.10/$0.30) are the most affordable. Use our Monthly Cost Projector to estimate your monthly bill.
Did this answer your question?
What is prompt caching and how does it reduce costs?
Prompt caching allows AI providers to reuse computations from identical input prefixes (like system prompts). OpenAI offers 50% discount on cached tokens; Anthropic offers up to 90% discount. If you send the same 1,000-token system prompt with every request, caching can reduce that portion of your costs by half or more. It's the single most effective cost reduction for production applications.
Did this answer your question?
How can I reduce my LLM API costs?
Top strategies: 1) Enable prompt caching for repeated system prompts. 2) Use smaller models (GPT-4o Mini, Gemini 2.5 Flash) for simple tasks. 3) Set explicit max_tokens to limit output length. 4) Shorten system prompts — they're sent with every request. 5) Use the Batch API (50% discount on OpenAI). 6) Truncate conversation history instead of sending full context. Use our token calculator to test token counts before and after optimization.
Did this answer your question?
What is a context window and how does it affect cost?
A context window is the maximum number of tokens a model can process in a single request (input + output combined). GPT-4o has 128K tokens, Claude supports 200K, Gemini 2.5 Pro supports 2M, and GPT-4.1 and Llama 4 support up to 1M. Larger contexts cost more (more input tokens) but allow processing longer documents. If your text exceeds the context window, you'll see an error and need to chunk your content.
Did this answer your question?
Is my text data safe when using this calculator?
Yes, completely. This token calculator runs entirely in your browser using WebAssembly. Your text is never sent to any server or API — all tokenization happens locally on your device. There is zero data collection, no cookies tracking your input, and no external API calls made with your text. You can verify this by checking your browser's Network tab in Developer Tools — you'll see no outbound requests when typing.
Did this answer your question?
How accurate is this compared to the official OpenAI tokenizer?
For OpenAI models (GPT-4o, GPT-4.1, GPT-3.5), this calculator uses the exact same tiktoken library that OpenAI's API uses, so the token count is 100% accurate. For Claude, Gemini, DeepSeek, and Llama, we use the closest available approximation — results may vary by 3-8% depending on text content and language. For production cost estimation, always verify with a small test call to the actual API.
Did this answer your question?