PDF token counter
The text layer is extracted page by page with pdf.js, up to 500 pages per file. Works on anything with real text — reports, contracts, papers, exported slide decks. Scans need OCR first, and the counter tells you when it hits one.
Count the tokens in a PDF, Word document, TXT, Markdown, JSON or CSV file — and see what it will cost to send. This PDF token calculator extracts the text and tokenizes it entirely in your browser, so nothing is uploaded and no sign-up is needed.
Processed in your browser — no upload
Drop a PDF, DOCX, TXT, MD or JSON file
or click to browse — multiple files welcome
Counts for OpenAI models are exact, produced by the same BPE tokenizer the API uses. Anthropic, Google, xAI, DeepSeek and Meta do not publish theirs, so those counts run your text through a BPE baseline and scale the result to the model’s own tokenizer — which is why Claude Opus 5 and Claude Sonnet 4.6 no longer report the same number.
Drop a PDF, DOCX, TXT, Markdown, JSON or CSV file onto the counter above, or click to browse. Several files at once is fine.
PDFs are read page by page with pdf.js; .docx archives are unzipped and their WordprocessingML walked in reading order. Nothing is sent anywhere.
The count is recalculated with that model’s tokenizer — exact for OpenAI, a labelled estimate for providers who keep theirs private.
Tokens, words, characters and input cost, plus how much of the model’s context window the document would occupy.
One tool for documents, prose and structured data. The extraction differs per format; the tokenizer does not.
The text layer is extracted page by page with pdf.js, up to 500 pages per file. Works on anything with real text — reports, contracts, papers, exported slide decks. Scans need OCR first, and the counter tells you when it hits one.
A .docx is a ZIP archive, so the counter unzips it in the browser and reads word/document.xml directly — paragraphs, tables and line breaks in document order, with field codes and tracked deletions skipped. Legacy binary .doc has to be re-saved as .docx or PDF.
Plain text is the simplest case: read as UTF-8 and tokenized exactly as it sits on disk. Useful for prompt files, transcripts, scraped copy and log excerpts you are about to paste into a model.
Markdown is counted as written, with the syntax included — because that is what the model receives. Heading hashes, list bullets, table pipes and fenced code markers are all tokens you pay for, which is why a README often counts higher than its word count suggests.
Braces, brackets, quotes, colons and indentation are all tokenized. Structured payloads are dramatically denser than prose — often close to one token per two characters — so counting before you inline a JSON blob into a prompt is worth the ten seconds. JSONL is supported too.
Data and markup formats are read as text and counted verbatim. Repeated tags, delimiters and quoting overhead dominate the count, so a spreadsheet export can cost several times what the same data would as prose.
Input rates only — output is billed separately and typically costs three to five times more.
| Model | Per 1M tokens | 1,000 tokens | 200,000 tokens | Tokens per $1 |
|---|---|---|---|---|
| GPT-5.6 TerraOpenAI | $2.00 | $0.00200 | $0.400 | 500,000 |
| GPT-5.6 LunaOpenAI | $0.200 | $0.00020 | $0.040 | 5,000,000 |
| GPT-5.5OpenAI | $5.00 | $0.00500 | $1.00 | 200,000 |
| Claude Sonnet 5Anthropic | $2.00 | $0.00200 | $0.400 | 500,000 |
| Claude Haiku 4.5Anthropic | $1.00 | $0.00100 | $0.200 | 1,000,000 |
| Gemini 3.1 ProGoogle | $2.00 | $0.00200 | $0.400 | 500,000 |
| Gemini 3.7 FlashGoogle | $0.750 | $0.00075 | $0.150 | 1,333,333 |
| Grok 4.6xAI | $2.00 | $0.00200 | $0.400 | 500,000 |
| DeepSeek V4 FlashDeepSeek | $0.440 | $0.00044 | $0.088 | 2,272,727 |
| Tokens | ≈ Words | ≈ Pages | GPT-5.6 Terra input |
|---|---|---|---|
| 1,000 | 750 | 1.5 | $0.00200 |
| 10,000 | 7,500 | 15 | $0.020 |
| 100,000 | 75,000 | 150 | $0.200 |
| 200,000 | 150,000 | 300 | $0.400 |
| 1,000,000 | 750,000 | 1,500 | $2.00 |
Assumes English prose at roughly 0.75 words per token and 500 words per page. Code, JSON and non-Latin scripts run considerably denser.
Run the text through the same tokenizer the model uses. OpenAI publishes theirs, so counts for GPT-5.6, GPT-5.4, GPT-4.1 and GPT-4o are exact — this page loads the real BPE vocabulary (o200k_base) in your browser and counts against it. Anthropic, Google, xAI, DeepSeek and Meta do not publish tokenizers, so those counts are approximations and are labelled "est." For a rough manual check on English prose, divide the character count by 4.
A PDF has to be turned back into text before it can be tokenized. Drop the file into the counter at the top of this page: it extracts the text layer page by page with pdf.js and tokenizes the result, entirely in your browser with no upload. If the count comes back empty, the PDF is almost certainly a scan with no text layer and would need OCR first.
About 750,000 words, or roughly 1,500 pages of ordinary prose — five or six full-length novels. In money it depends entirely on the model: 1,000,000 input tokens costs $2.00 on GPT-5.6 Terra, $0.200 on GPT-5.6 Luna and $5.00 on GPT-5.5. Output tokens are billed separately and cost three to five times more.
About 150,000 words, or roughly 300 pages — one full-length novel. It was the standard context-window ceiling for years, and the smaller models still stop there; the current flagships hold far more — GPT-5.6 Terra takes about 1,050,000 tokens, so a document that size no longer fills a request on its own. At GPT-5.6 Terra input rates it costs $0.400.
1,000 input tokens costs $0.00200 on GPT-5.6 Terra, $0.00020 on GPT-5.6 Luna, $0.00200 on Claude Sonnet 5 and $0.00200 on Gemini 3.1 Pro. Providers quote prices per million tokens, so divide the headline rate by 1,000 to get the per-1,000 figure.
Price = (input tokens ÷ 1,000,000) × input rate + (output tokens ÷ 1,000,000) × output rate. Count the two directions separately, because every provider charges more for what the model writes than for what you send it. If you reuse the same prompt prefix across requests, check whether a cached input rate applies — it is typically 10% to 50% of the standard rate.
Providers meter usage by token because tokens are what the model actually processes: every token in your prompt and every token in the reply consumes compute. You are billed for both directions on every request, which is why a long document resent on each turn of a conversation gets expensive quickly — the same pages are paid for again each time.
A token is a subword unit from the model’s byte-pair-encoding vocabulary — not a character and not a word. Common English words are usually one token; longer or rarer ones split into several, so "tokenization" becomes "token" + "ization". Punctuation and leading spaces count as well. English averages about 4 characters or 0.75 words per token, but code, JSON, non-Latin scripts and emoji are far denser, sometimes a token per character.
One dollar of input buys about 500,000 tokens on GPT-5.6 Terra, 5,000,000 on GPT-5.6 Luna, 200,000 on GPT-5.5 and 500,000 on Claude Sonnet 5. Divide 1,000,000 by the model’s per-million input price to get the figure for any model in the table above.
PDF, DOCX, TXT, Markdown (.md), JSON, JSONL, CSV, TSV, XML, HTML, YAML and plain log files. PDFs are parsed with pdf.js, .docx files are unzipped and read from their WordprocessingML, and everything else is read as UTF-8 text. Legacy binary .doc is not supported — save it as .docx or PDF first.
"Upload" here only means your browser reads the file from your disk. PDF parsing, .docx unzipping and tokenization all run as JavaScript on your device, and the tokenizer vocabularies are served from this site rather than a third-party CDN. No file content is transmitted, logged or stored, so confidential contracts and internal documents are safe to check.
10 MB per file, and PDFs are read up to their first 500 pages. Both limits exist to protect your own browser tab — extraction is sequential, and holding every page of a very large document in memory at once will freeze it. When a PDF is capped, the file row says how many pages were read.
Not directly. A scan is an image of text with no text layer, so there is nothing to extract and the counter reports that no text was found. Run the file through OCR first — most PDF tools have a "recognise text" option — then upload the searchable PDF it produces.
Yes. Select or drop several files and each gets its own row with its own token count, while the stat cards show the combined total. That combined figure is the one that matters if you plan to concatenate the documents into a single prompt.
Yes, for .docx and .docm. The counter unzips the archive, reads word/document.xml and walks its paragraphs, tables and line breaks in reading order, skipping field codes and tracked deletions. Headers, footers and footnotes live in separate parts of the archive and are not included in the count.
No. An encrypted PDF cannot be parsed without its password, and the counter reports it as protected rather than guessing. Open it with the password and re-save it, or use your PDF tool’s "remove security" option, then upload the unprotected copy.
Exact for OpenAI models, because it uses the same BPE vocabulary the API uses — a count of 12,431 tokens for GPT-5.6 is the number you will be billed for on that text. For Anthropic, Google, xAI, DeepSeek and Meta the figure is an estimate, marked "est.", and is usually within 10–15% on English prose. Extraction varies more than tokenization does: a PDF’s reading order, tables and column layout affect which whitespace ends up in the text, and whitespace is tokenized too.
Usually layout. Tables, multi-column pages, headers repeated on every page and hard line breaks all survive extraction, and every one of those newlines and stray spaces is a token. Scanned pages mixed into an otherwise text-based PDF drop out entirely and push the count the other way. Open the extracted-text panel under the counter to see exactly what was tokenized.
No. There is no sign-up, no API key and no rate limit. The tokenizers run locally in your browser, so there is no service to authenticate against and nothing to meter.
The main token calculator shows tokens as you type, with a colour-coded breakdown of how your text is split and a side-by-side price comparison across every model.