Tools

AI Token Calculator

Paste any prompt or document to count tokens and instantly estimate input, cached and output costs across every major model — GPT, Claude, Gemini, Grok, DeepSeek, Qwen, GLM, MiMo, MiniMax and Mistral. Pricing is an October 2026 snapshot from official provider docs.

Estimating… loading exact tokenizer
150characters
23words
38input tokens
8output tokens
≈ 21% of input
output tokens
Cost by provider
OpenAIexact
Input · 38 tok
$0.00038
Cached input
$0.000038
Output · 8 tok
$0.00040
Est. total
$0.00078

1.05M ctx · flagship

Anthropic≈ est.
Input · 44 tok
$0.00018
Cached input
$0.0000088
Output · 9 tok
$0.00018
Est. total
$0.00036

1M ctx · new flagship

Google Gemini≈ est.
Input · 40 tok
$0.000080
Cached input
$0.0000040
Output · 8 tok
$0.000080
Est. total
$0.00016

Intro price · limited access

Meta≈ est.
Input · 38 tok
$0.000048
Cached input
$0.0000057
Output · 8 tok
$0.000034
Est. total
$0.000082

1M ctx · coding-focused

xAI Grok≈ est.
Input · 38 tok
$0.000076
Cached input
$0.000019
Output · 8 tok
$0.000048
Est. total
$0.00012

500K ctx; ≥200K prompt doubles rates

DeepSeek≈ est.
Input · 40 tok
$0.000012
Cached input
$2.4e-7
Output · 8 tok
$0.0000096
Est. total
$0.000022

MIT · 1M ctx · peak rate; off-peak is half

Alibaba Qwen≈ est.
Input · 38 tok
$0.000076
Output · 8 tok
$0.000048
Est. total
$0.00012

1M ctx · open weights released

Z.ai GLM≈ est.
Input · 38 tok
$0.000053
Cached input
$0.0000099
Output · 8 tok
$0.000035
Est. total
$0.000088

1M ctx · open

Moonshot AI≈ est.
Input · 38 tok
$0.00011
Cached input
$0.000011
Output · 8 tok
$0.00012
Est. total
$0.00023

1M ctx · open weight

Xiaomi MiMo≈ est.
Input · 38 tok
$0.000017
Cached input
$1.4e-7
Output · 8 tok
$0.0000070
Est. total
$0.000023

1M ctx · omni · MIT open weights

Thinking Machines≈ est.
Input · 38 tok
$0.000071
Cached input
$0.000014
Output · 8 tok
$0.000037
Est. total
$0.00011

64K ctx · Apache 2.0

MiniMax≈ est.
Input · 38 tok
$0.000011
Output · 8 tok
$0.0000096
Est. total
$0.000021

1M ctx · open

Mistral≈ est.
Input · 42 tok
$0.000057
Output · 9 tok
$0.000038
Est. total
$0.000095

1M ctx · public preview; 50% off sale at launch

Perplexity≈ est.
Input · 38 tok
$0.000076
Output · 8 tok
$0.000064
Est. total
$0.00014

+ reasoning tokens billed

Prices are USD per 1M tokens, June 2026 snapshot. Only the OpenAI family is tokenized exactly (o200k); other counts are estimates (±15% typical for English; non-Latin scripts vary more). * = output price varies by source. Verify on the provider’s pricing page before relying on it.

What you can do with this calculator

Every model charges per token, so knowing your token count up front is the only way to predict cost before you call an API. This tool counts the input tokens in your text, estimates a realistic output length, and computes the cost for each provider so you can compare models side by side and pick the right price-performance fit.

  • Exact GPT tokenization. The OpenAI family is counted with the real o200k tokenizer; other models use calibrated estimates (English text is typically within ±15%).
  • Output presets. Switch between RAG / Q&A, Chat, Full response and Long generation, or override the output token count directly.
  • Cached input pricing. Where providers publish a cache-read rate, it’s shown so you can model prompt-caching savings.
  • Sort & copy. Rank providers cheapest-first and copy any estimate to share.

Current API prices (October 2026)

All prices are USD per 1M tokens, from official provider pricing pages.

ProviderModelInputCached inOutput
OpenAIGPT-6 Astra$10.00$1.00$50.00
OpenAIGPT-6.1 Sol$2.00$0.10$10.00
OpenAIGPT-6 Luna$0.10$0.01$0.50
AnthropicClaude Fable 5.1$10.00$0.25$50.00
AnthropicClaude Opus 5.5$4.00$0.20$20.00
AnthropicClaude Sonnet 5.5$2.00$0.10$10.00
AnthropicClaude Haiku 5.5$0.10$0.01$0.50
GoogleGemini 4 Argon$2.00$0.10$10.00
GoogleGemini 3.8 Flash$0.75$0.075$3.75
xAIGrok 4.7$2.00$0.50$6.00
DeepSeekV4.1-Flash$0.30$0.006$1.20
DeepSeekV4-Pro$1.32$0.044$3.96
AlibabaQwen3.8-Max$2.00—$6.00
AlibabaQwen3.8-Flash$0.15—$0.47
Z.aiGLM-5.3$1.40$0.26$4.40
Z.aiGLM-5.3-Flash$0.15$0.03$0.50
XiaomiMiMo-V2.6-Pro$0.435$0.0036$0.87
MiniMaxM3$0.30—$1.20
MistralLarge 4 (preview)$1.36—$4.18
Gemini 4 Argon and Gemini 3.8 Flash show introductory prices (Flash rises to $1.50 / $7.50 on January 1, 2027), and Argon is not yet generally available. DeepSeek shows the peak rate; off-peak is half. Mistral Large 4 is a public preview with a 50% launch sale in effect.

Programming language token efficiency, ranked

The same task costs wildly different token counts depending on the language. Terse functional and dynamic languages stay compact; verbose low-level and enterprise languages burn more tokens for identical work. Averages below use a RosettaCode task with GPT-family tokenization as the baseline.

LanguageAvg tokensTypesVerdict for LLM agents
J~70DynamicUltra-compact, niche tradeoff
Clojure~109DynamicBest for long agent sessions
Ruby~119DynamicVery token-efficient
Python~128DynamicStrong balance of cost & readability
Haskell~130StaticLean despite static typing
F#~136StaticEfficient typed option
Lisp~145DynamicCompact, less mainstream
Scala~166StaticAcceptable overhead
JavaScript~177DynamicUsable, not especially lean
Go~182StaticModerate token cost
C#~216StaticNoticeable token tax
Java~224StaticHigh token tax
C++~250StaticExpensive in long contexts
C~283StaticWorst for token efficiency
Methodology adapted from the RosettaCode token comparison published by tokencalculator.ai.

FAQ

What is a token?

Tokens are the chunks of text models read and write. One token is roughly four characters of English (about ¾ of a word) — so “ChatGPT” is about two tokens. Different models tokenize slightly differently, which is why counts vary per provider.

How accurate are the token counts?

The OpenAI family is exact (we run the real o200k tokenizer in your browser). Other providers don’t publish official JavaScript tokenizers, so those counts are calibrated estimates — usually within ±15% for English, with more variance for code and non-Latin scripts.

Why estimate output tokens?

Output tokens are usually the larger cost (often 3–6× the input rate), but you don’t know the exact length until the model responds. The presets give a realistic range by task type so your estimate is closer to the real bill.

What is cached input?

Many providers cache repeated prompt prefixes and bill cache reads at a steep discount (often ~10% of the input rate, and far less for DeepSeek). If you reuse a long system prompt, cached pricing can cut input cost dramatically.


Pricing snapshot: October 2026, compiled from official provider docs and our 2026 LLM landscape. Verify on the provider’s pricing page before relying on it. Runs entirely in your browser — no text is sent anywhere.