CalcPro

LLM Token Counter

Count tokens and estimate API cost for GPT-5.5, Claude, Gemini 3, Llama 4, DeepSeek, Grok and 60+ more LLMs.

Model

161 characters · 31 words. Tokenizing runs entirely in your browser — nothing is uploaded.

GPT-5.5Exact
tokens
Characters
161
Words
31
Tokens / word
1.29
Chars / token
3.27
Cost as input$0.00020

@ $5/1M in · $30/1M out · USD, indicative

Context window<0.1%

1,050,000 token window

Exact for OpenAI models (real tiktoken). BPE proxycounts tiktoken-family models (Llama 3+, Mistral, DeepSeek, Qwen, Grok) with the closest OpenAI encoding — very close, not byte-identical. Estimate uses characters-per-token for SentencePiece tokenizers (Claude, Gemini, Cohere) with no public JS port.

Same text across models

ModelMethodTokensInput cost
GPT-5.5 · OpenAIExact$0.00020
GPT-3.5 Turbo · OpenAIExact$0.000020
Claude Opus 4.8 · Anthropic≈ Estimate45$0.00023
Gemini 3.1 Pro · Google≈ Estimate40$0.000080
Llama 4 Maverick · Meta≈ BPE proxy$0.0000080
DeepSeek-V3.2 · DeepSeek≈ BPE proxy$0.000011
Grok 4.3 · xAI≈ BPE proxy$0.000050
Kimi K2.6 · Moonshot≈ Estimate42$0.000025

How it works

Language models never see your raw text. Before anything happens, your prompt is broken into tokens — short fragments the model was trained to recognise. Those tokens are what you pay for and what fills the model's context window, so knowing the count up front tells you both the cost and whether your prompt even fits.

This counter does the splitting live, in your browser, as you type or paste. Pick a model from the dropdown, drop your text in, and the readout updates instantly with the token count plus characters, words, tokens-per-word and characters-per-token. There is no upload step and no API call — the tokenizer code runs locally, so it works offline and is safe for confidential prompts.

The accuracy depends on which tokenizer the model uses, and the readout is honest about it with a badge:

  • Exact — OpenAI models, counted with their real tiktoken encoding (o200k_base for GPT-5/4o/4.1/o-series, cl100k_base for GPT-4 and GPT-3.5). This matches OpenAI's billing.
  • BPE proxy — Llama 3+, Mistral, DeepSeek, Qwen and Grok use byte-pair tokenizers in the tiktoken family, so they are counted with the closest OpenAI encoding. Expect a result within a few percent, not byte-identical.
  • Estimate — Claude, Gemini and Cohere use SentencePiece tokenizers with no public JavaScript port, so these use a calibrated characters-per-token ratio.

The formula

input cost (USD) = tokens ÷ 1,000,000 × input price per 1M tokens

Worked example

Say you paste a 1,200-word product brief and want to send it to GPT-4o.

  • The tiktoken o200k_base encoder counts it as roughly 1,560 tokens (badged Exact).
  • GPT-4o's indicative input price is $2.50 per 1M tokens.
  • Input cost = 1,560 ÷ 1,000,000 × 2.50 = $0.0039 — about four-tenths of a cent.
  • GPT-4o's context window is 128,000 tokens, so 1,560 tokens fills about 1.2% — plenty of room.

Now switch the dropdown to Claude Sonnet and the same text shows around 1,650 tokens (badged Estimate, from the characters-per-token ratio). The number is a little higher and clearly marked as approximate — useful for budgeting, but verify in Anthropic's console before a large batch.

The comparison table at the bottom runs your exact text through one representative model per family at once, so you can see the spread side by side:

Model Method Why it differs
GPT-5 / GPT-4o Exact Real tiktoken o200k_base
GPT-3.5 Turbo Exact Real tiktoken cl100k_base
Llama 3.1, Mistral, Grok BPE proxy tiktoken-family stand-in
DeepSeek-V3 BPE proxy cl100k_base stand-in
Claude, Gemini Estimate SentencePiece ratio

Tips

  • Count the whole prompt, including system messages. Hidden system prompts, few-shot examples and retrieved context all consume tokens. Paste everything the model will actually receive.
  • Budget for output too. This tool prices the input side; your bill also includes generated tokens, which are usually charged at a higher rate. Add an allowance for the reply.
  • Watch code and non-English text. Both tokenize less efficiently than plain English — more tokens per character — so check them rather than assuming the four-characters-per-token rule of thumb.
  • Treat cost as indicative. Prices move and vary by provider and region. Use the figure to compare models and size prompts, then confirm the live rate before high-volume runs.

Frequently asked questions

What is a token?

A token is the unit a language model actually reads — usually a short chunk of a word, a whole short word, or a piece of punctuation. Models bill and size their context windows in tokens, not characters or words. As a rough rule, one English token is about four characters or three-quarters of a word.

Which models are counted exactly?

OpenAI models (GPT-5, GPT-4o, GPT-4, GPT-3.5 and the o-series) are counted exactly using their real tiktoken encodings — o200k_base for the newest models and cl100k_base for the GPT-4 and 3.5 generation. The count matches what OpenAI's API charges.

How accurate are the counts for Claude, Gemini and Llama?

It depends on the tokenizer family. Llama 3+, Mistral, DeepSeek, Qwen and Grok use BPE tokenizers close to tiktoken, so they are counted with the nearest OpenAI encoding as a proxy — very close, but not byte-identical. Claude, Gemini and Cohere use SentencePiece tokenizers with no public JavaScript port, so those are estimated from a characters-per-token ratio. Each result is labelled Exact, BPE proxy or Estimate.

Is my text sent anywhere?

No. Tokenizing runs entirely in your browser. Nothing you paste is uploaded, logged or stored, which makes it safe to check prompts that contain private or sensitive content.

How is the cost figure calculated?

Cost shown is the input-side price — token count divided by one million, multiplied by the model's published input rate (USD). It is indicative; providers change prices, and your real bill also includes the tokens the model generates as output. Always confirm against the provider's current rate card.

Why does the same text give different token counts per model?

Every model is trained with its own tokenizer and vocabulary. A word that is one token for one model may split into two or three for another, especially for code, non-English text, numbers and rare words. That is exactly why the comparison table is useful before you commit to a model.