~/llm-token-counter ☀ LIGHT apps ← about me
// tokens · context windows · api cost
  ████████  ██████  ██   ██ ███████ ███    ██ ███████
     ██    ██    ██ ██  ██  ██      ████   ██ ██
     ██    ██    ██ █████   █████   ██ ██  ██ ███████
     ██    ██    ██ ██  ██  ██      ██  ██ ██      ██
     ██     ██████  ██   ██ ███████ ██   ████ ███████

LLM Token Counter & Cost Calculator

Count exact tokens for GPT-4o / GPT-4.1 / o-series (real tiktoken) and estimate Claude, Gemini, Llama, Mistral & DeepSeek. See context-window usage and API cost — 100% in your browser, your prompt never leaves the page.

Text / promptloading exact tokenizer…
0estimate
tokens
0
words
0
characters
context window0 / 0
Input cost: $0.00
ModelTokens% of windowInput cost

OpenAI counts (GPT-4o, GPT-4.1, o-series, GPT-4, GPT-3.5) are exact via in-browser tiktoken. All other models are calibrated estimates (typically within ~10%). Pricing is illustrative, in USD per 1M tokens, as of June 2026 — always verify current rates with each provider.

LLM Pricing & Context Window Comparison

Quick reference for the token limits and API pricing used by this calculator. Prices are in USD per 1 million tokens and are illustrative as of June 2026 — always confirm current rates with each provider. OpenAI token counts are exact (real tiktoken); other models use calibrated estimates.

Token limits and price per 1M tokens by model
ModelVendorContext windowInput $/1MOutput $/1MToken count
GPT-4oOpenAI128K$2.5$10Exact (tiktoken)
GPT-4o miniOpenAI128K$0.15$0.60Exact (tiktoken)
GPT-4.1OpenAI1M$2.0$8.0Exact (tiktoken)
o3OpenAI200K$2.0$8.0Exact (tiktoken)
GPT-3.5 TurboOpenAI16K$0.50$1.50Exact (tiktoken)
Claude Opus 4Anthropic200K$15$75Estimate
Claude Sonnet 4Anthropic200K$3$15Estimate
Claude HaikuAnthropic200K$0.80$4Estimate
Gemini 2.5 ProGoogle1M$1.25$10Estimate
Gemini 2.5 FlashGoogle1M$0.30$2.50Estimate
Llama 3.1 405BMeta128K$0.90$0.90Estimate
Mistral LargeMistral128K$2$6Estimate
DeepSeek V3DeepSeek128K$0.27$1.10Estimate
FAQ — LLM token counting & cost
How are tokens counted for OpenAI models?
GPT-4o, GPT-4.1 and o-series use o200k_base; GPT-4 and GPT-3.5 use cl100k_base — the real tiktoken byte-pair encoders, loaded and run in your browser. These counts are exact, matching what the OpenAI API charges.
Are Claude and Gemini counts exact?
No — Anthropic and Google don't publish browser tokenizers, so Claude, Gemini, Llama, Mistral and DeepSeek are calibrated estimates (usually within ~10%), clearly labelled as estimates.
Is my text sent to a server?
No. Tokenization and cost math run entirely client-side. Your prompt never leaves the page — safe for proprietary prompts.
What is a context window?
The maximum tokens a model can handle in one request (input + output combined). The gauge shows how much of the selected model's window your text uses.
Can I link directly to a token count?
Yes. Use ?text=Hello%20world&model=gpt-4o and the page opens with the text counted. Params: text (aliases t, q, prompt) and model. The address bar stays in sync for short inputs, so AI agents and scripts can deep-link straight to a count.
Is it free?
Yes, completely free, no signup, no ads. One of the free browser tools at jasperbernaers.com.