LLM Token Counter — Token & Cost Estimator for GPT-4o, GPT-4.1, Claude, Gemini

Free · no sign-up · no API key

LLM Token Counter

Paste a prompt, pick a model, and instantly see the estimated token count, how much of the context window it eats and the input cost in USD. All counting happens in your browser — nothing is uploaded.

openai token counter tiktoken online prompt token estimator

Token estimator

Count tokens and input cost

runs offline · nothing uploaded
Try a sample:
0 chars · 0 words · 0 lines
Plain text. Long coding-agent contexts welcome — counting runs locally and nothing is uploaded. Cap: 200,000 characters.
Each model uses a different tokenizer and price. Cost shown is input-token cost per 1M tokens.
Estimated tokens
≈ 0
0 / 128,000 tokens — 0% of the context window
Estimated input cost
≈ $0.0000
≈ $0.0000 per call · $0.00 per 1,000 calls
Model
gpt-4o
Input price
$2.50 / 1M in
Context window
128,000 tok

Tokenizer family: o200k · approx. — counted by a calibrated heuristic, not the provider's byte-exact tokenizer.

Heuristic estimate — a few percent off, not byte-exact tiktoken.

How the token estimate works

The counter splits your text into runs — ASCII words, digit groups, CJK / kana / hangul characters, other scripts, punctuation runs, newlines and emoji — and applies a per-script token weight calibrated against tiktoken (o200k and cl100k families), Claude and Gemini behaviour. A small per-model multiplier then corrects the total, and the cost is simply tokens × input $/1M. Everything is arithmetic over the pasted string: no network call, no account, no key.

1 · Segment

Text is classified character by character — Latin words, CJK characters, punctuation, newlines, emoji — so scripts are weighted differently.

2 · Weight

Each run is converted with a documented weight (word ≈ 1.1–1.3 tokens, CJK ≈ 0.7 tokens per char on o200k, emoji ≈ 2.5) and scaled by the model's tokenizer factor.

3 · Price

The estimate is multiplied by the model's input price per 1M tokens, compared to its context window and shown with a 4-significant-digit cost.

Models, prices and context windows

Input prices per 1M tokens, last checked against provider pricing pages in June 2025. Providers change prices — verify on the official pages before billing decisions.

Model Input $/1M Context window Tokenizer family Pricing page
gpt-4o$2.50128,000o200kopenai.com
gpt-4o-mini$0.15128,000o200kopenai.com
gpt-4.1$2.001,047,576o200kopenai.com
gpt-4.1-mini$0.401,047,576o200kopenai.com
o3-mini$1.10200,000o200kopenai.com
claude-sonnet-4$3.00200,000claudeanthropic.com
claude-haiku-3.5$0.80200,000claudeanthropic.com
gemini-2.0-flash$0.101,048,576geminiai.google.dev
other / generic$1.00128,000genericfallback estimate

FAQ

Is this an exact tiktoken count?

No. It is a calibrated heuristic: expect a few percent of drift from the provider's byte-exact tokenizer, more on CJK, emoji-heavy or minimal-whitespace text. For billing reconciliation, run the provider's own tokenizer.

Is my prompt uploaded anywhere?

Never. Segmentation, counting and pricing are plain arithmetic in your browser. The page makes no network request at all, so it keeps working offline once loaded.

How accurate is it for Chinese, Japanese or Korean?

CJK text is counted per character at 0.7 tokens under the o200k family, 1.2 under cl100k-style and 1.0 / 0.8 for Claude and Gemini, which lands within roughly ±15%. The result panel flags when non-Latin characters dominate so you know the estimate is softer.

Why is a chat transcript under-counted?

The paste is counted as one flat string, so the few tokens of overhead each role-delimited message adds in the real chat format are not included. Add roughly 4 tokens per message if you want to be safe.

What does the context-window bar warn about?

If the estimate passes the selected model's maximum context — 128k, 200k or 1M tokens depending on the model — the bar turns red and spells out how many tokens over the limit you are. The API would reject or truncate that request.

Do the prices stay current?

Input prices are a hardcoded table with the checked date shown above the table and a link to each provider's pricing page, so staleness is visible rather than hidden. Output tokens and multi-turn costs are out of scope.

Latest updates

More free tools

Step-by-step guides in our blog & guides.

Morocco End Of Service Benefits Calculator Best Online Currency Converter Photo Compressor To 30kb Photo Size Compressor 20kb Marked Share UAE School Holiday Calendar Lookup Photo to Maze Generator Word & Character Counter Online Free How Much Tax Should I Pay Calculator Online Invoice Generator Free