AI Token Counter & LLM Cost Calculator.
The free, open token calculator for GPT, Claude, Gemini, Grok, DeepSeek & LLaMA. Paste text, upload files, compare pricing — all in your browser.
Token Calculator.
Paste text or upload a file to count tokens, estimate costs, and see how much context window you'll use.
Drop files here or click to browse
Supports PDF, TXT, MD, JSON, CSV, XML — max 10MB
Count as an API request
Providers also bill the role and boundary tokens that wrap your text. Anthropic's own example — a short system prompt plus one message — costs 14 input tokens for 7 tokens of visible text.
LLM API Pricing.
Compare input & output token costs across all major AI providers. Prices per 1M tokens.
| Model | Input / 1Mper 1M tokens | Cachedper 1M tokens | Output / 1Mper 1M tokens | Context | Your Costestimated |
|---|---|---|---|---|---|
GPT-5.6 Sol OpenAI | $4.00 | $0.400 | $20.00 | 1M | — |
GPT-5.6 Terra | $2.00 | $0.200 | $12.00 | 1M | — |
GPT-5.6 Luna | $0.20 | $0.020 | $1.20 | 1M | — |
GPT-5.5 | $5.00 | $0.500 | $30.00 | 1M | — |
GPT-5.4 | $2.50 | $0.250 | $15.00 | 1M | — |
GPT-5.4 mini | $0.75 | $0.075 | $4.50 | 400K | — |
GPT-5.4 nano | $0.20 | $0.020 | $1.25 | 400K | — |
GPT-5.1 | $1.25 | $0.125 | $10.00 | 400K | — |
GPT-4.1 | $2.00 | $0.500 | $8.00 | 1M | — |
GPT-4o | $2.50 | $1.250 | $10.00 | 128K | — |
GPT-4o Mini | $0.15 | $0.075 | $0.60 | 128K | — |
Claude Fable 5 Anthropic | $10.00 | $1.000 | $50.00 | 1M | — |
Claude Opus 5 | $5.00 | $0.500 | $25.00 | 1M | — |
Claude Opus 4.8 | $5.00 | $0.500 | $25.00 | 1M | — |
Claude Opus 4.7 | $5.00 | $0.500 | $25.00 | 1M | — |
Claude Opus 4.6 | $5.00 | $0.500 | $25.00 | 1M | — |
Claude Opus 4.5 | $5.00 | $0.500 | $25.00 | 200K | — |
Claude Sonnet 5 | $2.00 | $0.200 | $10.00 | 1M | — |
Claude Sonnet 4.6 | $3.00 | $0.300 | $15.00 | 1M | — |
Claude Sonnet 4.5 | $3.00 | $0.300 | $15.00 | 200K | — |
Claude Haiku 4.5 | $1.00 | $0.100 | $5.00 | 200K | — |
Gemini 3.1 Pro Google | $2.00 | $0.200 | $12.00 | 1M | — |
Gemini 3.7 Flash | $0.75 | $0.075 | $3.75 | 1M | — |
Gemini 3.5 Flash | $1.50 | $0.150 | $9.00 | 1M | — |
Gemini 3.5 Flash-Lite | $0.30 | $0.030 | $2.50 | 1M | — |
Gemini 2.5 Pro | $1.25 | $0.125 | $10.00 | 1M | — |
Grok 4.6 xAI | $2.00 | $0.500 | $6.00 | 500K | — |
Grok 4.5 | $2.00 | $0.300 | $6.00 | 500K | — |
Grok 4.3 | $1.25 | $0.200 | $2.50 | 1M | — |
Grok Build 0.1 | $1.00 | $0.200 | $2.00 | 256K | — |
DeepSeek V4 Pro DeepSeek | $1.32 | $0.044 | $3.96 | 1M | — |
DeepSeek V4 Flash | $0.44 | $0.014 | $1.32 | 1M | — |
LLaMA 3.3 70B Meta (via API) | $1.04 | — | $1.04 | 128K | — |
Qwen3.7 Max Alibaba | $2.50 | $0.250 | $7.50 | 1M | — |
Prices reflect standard text API rates. Excludes batch, media, tools, and storage charges.
Everything you need.
A complete toolkit for understanding and optimizing your LLM token usage.
Real-time Counting
Tokens counted instantly as you type — no submit button, no waiting.
File Upload
Upload PDF, TXT, Markdown, JSON, CSV or XML. Token count in seconds.
Token Visualizer
See exactly how your text gets broken into tokens with color-coded chips.
Cost Comparison
Compare costs across GPT, Claude, Gemini, Grok, DeepSeek and LLaMA models.
Context Window
Track how much of each model's context window your prompt uses.
100% Free
No sign-up, no limits, no API keys. Everything runs in your browser.
Three simple steps.
Paste or Upload
Enter your text or upload a document file.
Select Model
Choose your target LLM model for accurate pricing.
Get Results
See token count, cost estimate, and context window usage instantly.
A token counter for every model you actually use
Token Counter AI is a free token counter and token calculator for large language models. Paste text or drop a file and it tells you how many tokens the text is worth, what sending it would cost, and how much of the model's context window it would occupy — across 34 models from 7 providers, without an account, an API key or a single byte leaving your browser.
What a token actually is
Language models do not read characters and they do not read words. They read tokens: fragments of text drawn from a fixed vocabulary that the model was trained with. Common English words are usually one token each. Longer or rarer words break into pieces, so "tokenization" arrives at the model as "token" plus "ization". Punctuation counts. Line breaks count. The space in front of a word is part of the token that follows it, which is why "hello" and " hello" are two different tokens with two different IDs.
That is the unit everything else is quoted in. Context windows are measured in tokens, API prices are quoted per million tokens, and rate limits are counted in tokens per minute. For ordinary English prose the working ratio is about 4 characters or 0.75 of a word per token — so 1,000 tokens is roughly 750 words, and 1,000,000 tokens is around 750,000 words, or 1,500 printed pages. Code, JSON, tables and non-Latin scripts are all considerably denser than that, which is exactly where estimates stop being useful.
Why exact counts beat character estimates
Dividing your character count by four is a reasonable guess for an English paragraph and a bad one for anything else. A minified JSON payload can cost twice what the ratio predicts. A Hindi or Japanese passage can cost half again as much as its length suggests. Source code with deep indentation spends tokens on whitespace. If you are sizing a prompt against a context limit or forecasting a monthly bill, a guess that is 40% out is not a forecast.
So this tool does not estimate where it does not have to. For OpenAI models it loads the real byte-pair-encoding vocabulary — o200k_base, the same ranks the API uses — and runs it in your browser tab. The number it shows is the number you are billed for, not an approximation of it. That makes it a genuine OpenAI tokenizer rather than a character-counting approximation with a tokenizer's name.
11 of the models in the comparison are counted this way, with the provider's own tokenizer. The rest belong to providers who have never published theirs — Anthropic, Google and xAI all keep their vocabularies closed — and for those the count is a calibrated estimate, labelled as an estimate everywhere it appears. Where a provider offers a counting endpoint instead, such as Anthropic's, the page says so and links to it. Nowhere does a guess get presented as a certainty.
Every model, one number
The picker carries 34 models from 7 providers, and the full pricing comparison covers 56 models from 11 — OpenAI's GPT line, Anthropic's Claude family, Google's Gemini, xAI's Grok, DeepSeek, Qwen and Llama. Switching model re-prices the same text instantly. Within a single vendor's current generation the token count usually does not change at all, because those models share a vocabulary; what changes is the rate.
The spread between those rates is the reason this matters. GPT-5.6 Terra runs $2.00 per million input tokens against $12.00 per million output. Claude Sonnet 5 is $2.00 in and $10.00 out; Gemini 3.1 Pro is $2.00 and $12.00; Grok 4.6 is $2.00 and $6.00. At the bottom of the range, GPT-4o Mini takes input at $0.150 per million. Output is always the expensive direction, and it is the one people forget to budget for.
Turning tokens into a budget
Counting tokens is a means to an end: knowing what something costs before you run it a hundred thousand times. The results panel converts as you type, so a prompt you are about to put into production shows its per-call input cost immediately. One dollar of input buys roughly 500,000 tokens on GPT-5.6 Terra and about 6,666,667 on GPT-4o Mini — a difference that is invisible in a single test and decisive at scale.
Two things bend the curve in your favour, and both are visible here. Cached input is far cheaper than fresh input when requests share a prompt prefix: on GPT-5.6 Terra the cached rate is $0.200 per million against $2.00 standard. And a shorter system prompt saves money on every single call, forever — trimming 500 tokens from a prompt that runs a million times a month saves $1000.00 a month on that model alone. Neither optimisation is obvious until you can see the token count move.
Whole files, not just pasted text
Most real questions are about documents rather than paragraphs. Switch to the file tab and drop in a PDF, a Word document, a plain-text or Markdown file, JSON or CSV, and the text is extracted and counted in place. Several files at once is fine: each gets its own line and the totals add up, which is the fastest way to find out whether a folder of contracts, transcripts or scraped pages fits inside a context window before you write any code against it.
Because the context bar reads against the selected model rather than a fixed number, it answers the question that actually matters — not "how big is this file" but "does this file fit, and how much room is left for the reply". A 1,050,000 token window sounds unlimited until a document, a system prompt and a conversation history are all competing for it.
Nothing leaves your browser
The tokenizer, the file parsing and the arithmetic all run client-side, in the page you are already looking at. There is no upload step, no server round trip, no request log and no account. Close the tab and nothing persists. That is a design constraint rather than a policy promise: the code has nowhere to send your text even if it wanted to, which is what makes it usable on a draft contract, an unreleased spec or a customer transcript that could not be pasted into a hosted tool at all.
Who this is for
Developers sizing prompts against a context limit and forecasting API spend before a launch. Writers and researchers checking whether a manuscript will fit in one pass. Product and finance teams turning a usage estimate into a line item. Students and anyone who has hit a truncation error and wants to know how far over the limit they went — and anyone who has typed "how many tokens is 1,000 words" into a search box and wanted a straight answer rather than a signup form. The answer, for the record, is about 1,333 tokens of English prose, and you can verify it in the counter above in about five seconds.
Token counter questions, answered.
Straight answers to what people actually ask about tokens — what one is, how many words 1,000 tokens comes to, what a million costs, and how this token counter arrives at its numbers. Every figure below is read from the same pricing data as the calculator at the top of this page.
Token basics
What is a token counter?
A token counter is a tool that tells you how many tokens a piece of text becomes once a language model reads it. Models are billed, limited and rate-limited in tokens rather than words, so that count is what decides whether a prompt fits and what it costs. This token counter runs the real tokenizer in your browser across 34 models from 7 providers and shows the count, the cost and the share of the context window together.
What is a token?
A token is the basic unit of text an AI model processes. It can be a whole word, a fragment of one, a punctuation mark or a single character. Common English words are usually one token each, while longer or rarer words split into pieces — "tokenization" arrives at the model as "token" plus "ization". For ordinary English, one token averages about 4 characters, or 0.75 of a word.
How long is one token?
About 4 characters of English prose, which works out to roughly 0.75 of a word. That is an average, not a rule: "the" is one token of three characters, while a long URL or a base64 blob can cost a token per character. In money, one input token on GPT-5.6 Terra is $0.000002 — which is why rates are always quoted per million rather than per token.
What does "tokenize" mean?
To tokenize text is to split it into the vocabulary units a model actually reads, then map each unit to an integer ID. The model never sees your characters; it sees that list of IDs. Tokenizing is deterministic — the same text always produces the same tokens — and reversible, so decoding the IDs returns the original text byte for byte. Counting tokens means tokenizing the text and reporting how many pieces came out.
What are the five types of tokens?
The five-type classification comes from compiler theory rather than AI: a lexer sorts source code into keywords, identifiers, operators, separators and literals. Language models do not use those categories. For LLM tokenization the useful split is different — whole words, subword fragments, single characters or raw bytes, punctuation and whitespace, and special control tokens such as end-of-text markers. Only that last kind is added by the API rather than by your text.
Token counts and word equivalents
How many words are 1000 tokens?
About 750 words of English prose, using the working ratio of 0.75 words per token. Going the other way, 1,000 words is roughly 1,333 tokens. Both directions are estimates and only hold for prose: 1,000 tokens of minified JSON, source code, or Hindi and Japanese text carries far fewer words than that. Counting beats dividing for exactly that reason.
How much is 200,000 tokens?
Around 150,000 words, or about 300 printed pages at 500 words a page — a full-length novel. It is also a common context-window size, so "does this fit in 200K" is usually the real question. As spend, 200,000 input tokens cost $0.400 on GPT-5.6 Terra and $0.030 on GPT-4o Mini.
How long is 1 million tokens?
About 750,000 words, or roughly 1,500 pages of printed text — call it eight average novels. Several models now accept that much in a single request: GPT-5.6 Sol has a 1M-token window and Claude Sonnet 5 has 1M. Reading a million tokens aloud would take somewhere near ninety hours.
How much is 2 million tokens?
Roughly 1,500,000 words, or about 3,000 printed pages. No model in the picker takes that in one request — the largest window here is 1M tokens — so two million usually describes a monthly budget or a document set you will need to chunk. As spend it is $4.00 of input on GPT-5.6 Terra, or $0.300 on GPT-4o Mini.
What is a 1m token?
"1M tokens" is shorthand for one million tokens, and it appears in two places. As a context window it means the model can hold about 750,000 words of prompt, documents and history at once. As a pricing unit it is how every provider quotes rates — $2.00 per 1M input tokens on GPT-5.6 Terra works out to $0.000002 per token. It has nothing to do with crypto tokens.
What tokens cost
How much are 1000 tokens worth?
On GPT-5.6 Terra, at $2.00 per million, 1,000 input tokens cost $0.00200 and 1,000 output tokens cost $0.012 — output is always the expensive direction. Across the whole picker the same 1,000 input tokens range from $0.00015 on GPT-4o Mini to $0.010 on Claude Fable 5, a 67× spread. The text does not change; only the bill does.
How much is 1,000,000 tokens?
One million tokens is exactly one billing unit — every provider quotes rates per million, so this is the number printed on the pricing page. On GPT-5.6 Terra a million input tokens is $2.00, which means one dollar buys 500,000 tokens, or about 375,000 words. Output is dearer at $12.00 per million. At the cheap end GPT-4o Mini charges $0.150, so the same dollar goes 13 times further.
How are costs calculated?
Token count multiplied by the selected model's published rate, with input and output priced separately. Paste or upload text here and it is counted as input, with the per-call cost shown immediately. Cached input — where consecutive requests share a prompt prefix — is cheaper again: $0.200 per million on GPT-5.6 Terra against $2.00 standard. Rates come from each provider's own pricing page and are re-checked regularly.
Counting tokens
How can I calculate tokens?
Three ways, in descending order of effort. Paste the text into the counter at the top of this page and read the number — exact for OpenAI models, because the real o200k_base vocabulary runs in your browser. Call a tokenizer library yourself: tiktoken for OpenAI, SentencePiece for Google, Hugging Face tokenizers for open models. Or divide your character count by 4 for a rough guess that drifts badly on code, JSON and non-Latin scripts.
How to get token count?
For a quick answer, paste text or drop a file into the counter above and the count
appears as you type — no account, no API key, nothing uploaded. In code, use the
provider's own tokenizer: len(enc.encode(text)) with tiktoken in Python, or
js-tiktoken in JavaScript. Where a vocabulary is not published, use the provider's
counting endpoint instead — Anthropic's count-tokens endpoint is the only exact way to
get a Claude figure.
How is an AI token calculated?
By running a byte-pair-encoding pass, not by counting characters or words. The tokenizer splits your text with a fixed regex, then repeatedly merges the most frequent adjacent byte pair according to a merge table learned during training, until no merge applies. The pieces left over are the tokens, each mapped to an integer ID. o200k_base, the encoding current OpenAI models use, holds about 200,000 such pieces; the older cl100k_base holds about 100,000.
Is this token calculator accurate?
For OpenAI models, exactly — it runs OpenAI's own open-source BPE vocabulary in your browser, so the number matches what you are billed. 11 of the 56 models in the comparison are counted that way. Anthropic, Google, xAI, DeepSeek and Meta do not publish their tokenizers, so those counts are calibrated estimates and are labelled as estimates next to the total. Treat them as a close guide, not a billing figure.
Can I upload PDF files?
Yes. PDF, DOCX, TXT, Markdown, JSON, CSV and XML are supported, up to 10MB, and several files at once is fine — each gets its own line and the totals add up. PDFs are parsed entirely in your browser with PDF.js; nothing is uploaded. A scanned PDF with no embedded text cannot be read, and the tool says so rather than returning a misleading count.
Tokenizers
What does a tokenizer do?
It converts text into the integer IDs a model can process, and converts them back again. Concretely: it splits the text into candidate chunks with a regex, runs byte-pair merges over each chunk against a fixed vocabulary, and emits one ID per surviving piece. It also handles the awkward parts — the leading space that makes "hello" and " hello" two different tokens, bytes that are not valid UTF-8, and the control tokens that mark where a message begins and ends.
What is tokenizer used for?
Every text operation a model performs begins and ends with one, so the tokenizer is what makes your input legible to the model at all. Outside the model you use one to count tokens before sending a request, to price a prompt, to check a document against a context window, to chunk text for a vector database on token boundaries rather than character ones, and to trim conversation history so it still fits.
What is tokenization with an example?
Tokenization is splitting text into the units a model reads. "Token counter" is two tokens, because both words are common enough to have their own vocabulary entry — and the space belongs to the second one, so " counter" and "counter" are different tokens. The word "tokenization" is rarer, so it splits into "token" plus "ization": one word, two tokens. Rarer still breaks down further — "unbelievably" costs three, as "un" plus "bel" plus "ievably". The visualiser above shows the exact split for any text you paste.
Who provides tokenization?
In AI, the model's own vendor. OpenAI publishes tiktoken, Google open-sourced SentencePiece, Meta ships its tokenizer with the Llama weights, and Hugging Face's tokenizers library implements BPE, WordPiece and Unigram for open models. Anthropic, Google's Gemini and xAI keep their production vocabularies closed and offer counting endpoints instead. If you came looking for payment tokenization, that is an unrelated service from card networks and payment processors.
How do I train a tokenizer?
Pick an algorithm — BPE, WordPiece or Unigram — assemble a corpus that resembles the text you will actually process, choose a vocabulary size, and run a trainer such as Hugging Face tokenizers or SentencePiece; it outputs a vocabulary and a merge table. A larger vocabulary means fewer tokens per document but a bigger embedding matrix. One caveat matters most: you cannot retrain a tokenizer for an existing model, because its vocabulary is welded to the embedding weights.
Privacy and price
Is it really free?
Yes, completely free and with no limits — no sign-up, no API key, no trial, no paid tier holding the useful part back. Everything runs in your browser, so there is no server to meter and nothing for us to bill: you can count 1,000,000 tokens as easily as ten. The 34 models in the picker are all available to everyone, and so is file upload.
Do you store my data?
No. The tokenizer, the file parsing and the arithmetic all run locally in the page you are already looking at. Nothing is ever sent to a server, because there is no server to send it to — which is what makes this usable on a draft contract, an unreleased spec or a customer transcript. Close the tab and nothing persists.