Free token counter
Paste text or drop a file to get the exact OpenAI token count, a Claude estimate, and a quick check against common context window sizes. It runs in your browser, so your document never leaves your device.
Or drop a file, or click to choose one
PDF, DOCX, TXT, Markdown, CSV or HTML · up to 25MB · never leaves your device
How it works
- 1
Paste text or drop a file
A prompt, a chapter, a whole handbook. PDF, Word, Markdown, CSV, HTML and plain text all work.
- 2
Your browser does the counting
The file is read on your device and run through the same tokenizer OpenAI uses. Nothing is uploaded, so private documents stay private.
- 3
See what fits
Get exact OpenAI token counts, a Claude estimate, words, characters and pages, and a quick check against common context window sizes.
What a token is
Models don't read words; they read tokens, which are chunks of text from a fixed vocabulary. Common English words are usually one token, longer or rarer words get split into pieces, and spaces and punctuation count too. A rough average for English is about four characters, or three-quarters of a word, per token. Code, numbers, tables and most other languages use more.
Every context window, rate limit and API bill is measured in tokens, so a word count only gets you close. When you need to know whether a prompt fits, or how much of a document a model can take in at once, count the tokens. For word counts, page stats and reading time across several PDFs at once, use the PDF word counter.
Why ChatGPT and Claude give different numbers
Each model family has its own tokenizer. OpenAI publishes its tokenizers, which is why this page can match OpenAI's count exactly: o200k_base for current models, and the older cl100k_base for GPT-4 and GPT-3.5. The newer encoding has a bigger vocabulary, so the same text usually takes fewer tokens, especially outside English.
Claude uses a different tokenizer that Anthropic doesn't release for offline use. The Claude figures here are estimates based on Anthropic's published rule of thumb. Treat them as a planning number, not an exact one.
Token counts and knowledge files
When you give ChatGPT or Claude a document to work from, the token count tells you how it will be handled. A file that fits in the context window can be read whole. A larger one gets searched, and the model only sees the passages the search picks out. That is why a 300-page PDF sometimes "misses" an answer that is plainly in it.
Smaller, clean files give that search a better shot. If a document is far over the window, split it into focused files and strip out the page furniture first. Here is how to pick a chunk size, or run one file through the free knowledge base builder, which cleans and splits it for you.
Frequently asked questions
- Is this an exact OpenAI token count?
- Yes, for the text itself. It uses gpt-tokenizer, an open-source JavaScript port of OpenAI's tiktoken, with the o200k_base encoding (GPT-4o, GPT-4.1, the o-series and GPT-5) and, when you click to show it, cl100k_base (GPT-4 and GPT-3.5). Chat messages and tool definitions add a few formatting tokens on top, so a full API request can come out slightly higher.
- How accurate is the Claude token count?
- It is an estimate. Anthropic does not publish a tokenizer you can run offline. Its pricing docs give a rule of thumb of about 4 English characters per token, and say Claude Opus 4.7 and later produce roughly 30% more tokens for the same text, so we show both. Code, tables and non-English text usually run higher. For an exact number, use Anthropic's token counting API.
- Is my file uploaded anywhere?
- No. The page reads your file and counts it inside your browser. Nothing is sent to our servers or anyone else's, and nothing is stored. Once the page has loaded, it keeps working even if you go offline.
- Why does my PDF count look low, or come back empty?
- Only the PDF's text layer is counted, which is also what ChatGPT reads on most plans. A scanned PDF is just pictures of pages with no text layer, so there is nothing to count until it goes through OCR. Headers, footers and page numbers are counted too, which is one reason cleaning a file before upload helps.
- Is this a token calculator for API costs?
- It counts tokens; it does not price them, because prices change often and differ by model. To estimate a cost, take the token count and multiply by the per-million-token rate on the provider's pricing page. Remember that the reply is billed too, usually at a higher rate.
- My document is bigger than the context window. What now?
- You can still upload it as a file. ChatGPT and Claude search uploaded files and pull in the relevant passages instead of reading everything at once. OpenAI caps each text file at 2 million tokens. Search works better on clean, smaller files than on one giant export, so split very large documents by chapter or topic.
Need a whole folder turned into clean knowledge files for ChatGPT or Claude? KBP packs from $9 once.
More free tools
Related guides
ChatGPT & Claude Knowledge Files
Prepare files so ChatGPT actually finds what's in the PDF.
Document Prep, Chunking & RAG
Turn messy documents into clean, retrieval-ready chunks.
Tool Comparisons & Alternatives
How Knowledge Builder Pro compares to the alternatives.
ChatGPT & Claude Build Guides
Step-by-step builds for real use cases.