The AI Token Calculator for developers

Count tokens for GPT-5, GPT-4o, Claude 4, Gemini, Llama, DeepSeek and 90+ other models — exact tiktoken counts for OpenAI, proven estimates for everyone else, with per-call API cost in dollars. Instant, free, 100% in your browser.

90+ models Exact tiktoken counts $0 setup Private — nothing uploaded
Advertisement
Your text
0
Leave defaults, or set your own.
Model defaults filled in.
Results — recalculated live
Tokens
Characters
Words
Lines
Bytes (UTF-8)
Tokens / char
Input cost
Output cost (same volume)
Estimated request cost
Private by design: text is tokenized locally with tiktoken — nothing is uploaded.
Advertisement

Why developers use this token calculator

Stop guessing with character counters. Get invoice-accurate token usage before you ship an app or a prompt.

Σ Exact tiktoken counts

Uses the same Byte-Pair-Encoding tokenizer that OpenAI runs in production — identical results for GPT-5, GPT-4o, o3, o4-mini, GPT-4.1 and every other OpenAI model. Other providers get a proven estimate mode.

$ Cost before you code

Convert any prompt, context window or dataset dump into a dollar estimate instantly. 90+ models preloaded with official list prices, or set custom per-million-token prices for any provider or plan.

# 100% local & private

No account, no API key, no upload. The tokenizer runs in your browser, so prompts and code never leave your machine — even offline once loaded.

Built for AI workflows

Paste or drop any text file, watch token, character, word, line and byte stats update live, and copy one-line summaries into prompts or tickets.

Supported models & pricing

90+ models across OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, Qwen, xAI, Alibaba and more. exact rows are counted with the real tiktoken tokenizer in your browser; estimate rows cover models whose proprietary tokenizers can't run in a browser (about 4 chars per token). Prices are official list prices per 1M tokens and change over time — the calculator lets you override any of them.

Model Precision Context Input / 1M Output / 1M

Tokenizer registry: o200k_base (GPT-5 / GPT-4o / o1 / o3 / o4-mini / GPT-4.1 / gpt-4o-mini), cl100k_base (GPT-4 / GPT-3.5 Turbo / embeddings), p50k_base (text-davinci-003), r50k_base (davinci-002).

Advertisement

Developer guides

Learn how tokens and token prices actually work before you ship.

W How many tokens is a word?

Token-per-word ratios for GPT-5, GPT-4o, Claude, Gemini, Llama and DeepSeek, with quick estimates and exact counts — no more guessing with word counters.

Read the guide →

$ AI API pricing in 2026

Per-1M-token prices for every major model in one table, the exact per-request formula, and seven ways to cut your LLM API bill — including reasoning-token traps.

Read the guide →

Frequently asked questions

Everything developers ask before shipping an AI feature.

What is an AI token?

A token is the smallest unit of text a language model reads and generates. In English, one token is roughly 0.75 words, but code, punctuation and emoji tokenize differently. API providers bill every request in tokens, which is why developers need a proper token counter and not a character counter.

How accurate is this token calculator?

For every OpenAI model in the list it is exact: the calculator runs the tiktoken tokenizer — the same Byte-Pair-Encoding implementation used on OpenAI's servers — locally in your browser. Your count equals your invoice, down to the last token. For Claude, Gemini, Llama, DeepSeek, Qwen and other providers the tool switches to its estimate mode (about 4 characters per token), which is a proven ballpark for prompt sizing and cost planning.

Is my text uploaded or stored?

No. Everything happens client-side with JavaScript. Your prompts, code and documents never leave your device, no analytics are collected from the text you type, and the page keeps working after the tokenizer data loads.

How do I estimate the cost of a chat request?

Pick your model in the calculator, paste your conversation (system prompt + user messages), read the token count, then multiply by the per-1M-input price. Use our output price control for the assistant's reply, or the total estimate for a typical round-trip. You can also enter your own per-million prices if your plan differs.

Why is my token count different from GPT-4o vs GPT-4?

Different model families use different tokenizers. GPT-5, GPT-4o and o-series use o200k_base, while GPT-4 and GPT-3.5 use cl100k_base. The calculator switches tokenizers automatically when you change models, so compare like for like.

Does it support Claude, Gemini or Llama?

Yes. Those models use proprietary tokenizers, so exact counts aren't possible in a browser. The calculator's “estimate” mode assumes about 4 characters per token (a well-known rule of thumb) so you still get a usable ballpark number — and it covers the whole lineup: Claude 4, Opus, Sonnet and Haiku, Gemini 2.5 Pro and Flash, Llama 4 and 3, DeepSeek V3 and R1, Qwen, Mistral, Grok, Kimi, GLM and dozens more.