File Token Counter
Count tokens in PDF, Word, Excel, CSV or JSON, several files at once, right in your browser. Shows context window usage. No upload.
Your inputs are processed in your browser and are not transmitted to our servers. Note: third-party resources (e.g. advertising and analytics from Google/Cloudflare) and an optional PayPal donation link may transfer data when loading or when clicked. Browser extensions or plugins may be able to read content that is visible in the input fields.
The result will appear here …
File Token Counter: Count Tokens in PDF, Word and Excel
Want to know how many tokens a whole document takes up at an AI model? The file token counter reads PDF, Word (DOCX), Excel (XLSX), CSV, JSON and text formats directly in your browser and counts tokens with the official OpenAI tokenizer o200k_base (GPT-4o, GPT-5.x, GPT-6) or the older cl100k_base. Several files at once are no problem: the table shows each file separately plus the total. Nothing gets uploaded, all processing runs on your device.
How it works
Drop files into the input field, pick the tokenizer and click Count tokens. The tool extracts the text of each document: PDF via the text layer, Word via the document paragraphs, Excel via every cell of every sheet, CSV, JSON and text directly. It then counts tokens, characters and words per file and shows how much of the context window the total uses on the current models.
What it is good for
- Checking whether a long document fits the context window before sending it to a model
- Estimating API costs before processing documents
- Comparing how file formats differ in token cost
- Checking a whole document package at once instead of file by file
What the counter really measures
The counter reads the plain text of a document. For PDF that is the text layer: a scanned printout without one counts 0 tokens, even though a model reading the image data would use more. For Excel it counts cell contents, not the table structure. Formulas, formatting and layout are lost, exactly like in a copy-paste into the model. For the question "does this content fit the context window?" that is the right basis, but the provider's own response stays authoritative for exact API billing.
Context windows of the current models
- GPT-6 / GPT-6.1 / GPT-5.6: 1,050,000 tokens
- Claude Opus 5.5 / Sonnet 5.5: 1,000,000 tokens
- Gemini 4 Argon: 1,048,576 tokens, unified window for input and output
- GPT-4o / GPT-4.1 / o1: 128,000 tokens
- GPT-4 / GPT-3.5 Turbo: 8,192 tokens (legacy)
Frequently asked questions
Are my files uploaded?
No. PDF, Word and Excel are opened and read directly in your browser, and token counting runs locally too. Your files never leave your device.
How many files can I count at once?
Up to 20 files per run. The table lists each file with tokens, characters and words, and the total below comes with the context window usage.
Why does my scanned PDF show 0 tokens?
A scan without a text layer contains no readable text, so the counter finds nothing. Models would use more tokens processing the image data, but there is no reliable local estimate for that. Run OCR on scans first, then count again.
Which formats are supported?
PDF, Word (DOCX), Excel (XLSX), CSV and TSV, JSON, plus text formats like TXT, Markdown, XML, HTML and source code. Old Word formats (.doc) and binary formats are not read.
How accurate is the count for GPT-6?
The counter uses the o200k_base tokenizer, the same one as GPT-4o and the GPT-5 family. That is the common basis for the GPT-6 models, but OpenAI has not officially confirmed the mapping yet. Treat the number as a very good estimate, not a guarantee.
What does counting large files cost?
Nothing. The calculation runs in your browser, there is no account and no limit besides 20 files per run. Very large files are capped at 2 million characters each, the table says so when it happens.
Read more about this tool
Why files instead of a text field?
A prompt with an attached document consumes the tokens of the document, not just those of your question. Anyone who wants to know whether a 30-document package, a manual or a data export fits the window would otherwise paste every file into a text field by hand. The file token counter takes the folder contents at once and runs the total against the context windows of the current models.
How the extraction works
PDF files are read page by page with pdf.js, the text layers of all pages are merged. Word files are ZIP archives: the counter opens them locally and collects the text paragraphs from the document XML. Excel files work the same way, every text entry and numeric value of every worksheet goes into the count. CSV, JSON and text formats are read directly. After that the same tokenizer takes over as in the token counter for text.
Tokens vs. characters in documents
For English prose the rule of thumb is one token per four characters or 0.75 words. German documents usually sit a little higher because of compound words, tables and JSON much higher because of numbers and punctuation. That is why a real count with the tokenizer is the only reliable number: a character-based estimate can be off by multiples for structured data.
Does everything run locally?
Yes. Extraction and token counting happen entirely in your browser, there is no upload and no server contact for your files. You can count confidential contracts, invoices or customer data without sending them anywhere.