File to Tokens
Files
Drop PDF, DOCX, TXT, or MD here, or click to browse
Up to 5 files, 20 MB each — nothing leaves your browser
Model
.pdf, .docx, .txt, .md up to 20 MB each · stays in your browser
Sample result
Sample result — a 62-page annual report. Drop your own PDF, DOCX, TXT, or MD to replace it.
Total tokens · GPT-4o
145,320
611,000 characters · 104,000 words · 62 pages · ~$0.3633 to send once
Will it fit?
145,320 / 1,050,000 — 904,680 tokens spare
145,320 / 1,050,000 — 904,680 tokens spare
145,320 / 1,050,000 — 904,680 tokens spare
145,320 / 128,000 — exceeds by 17,320 tokens (14%)
145,320 / 128,000 — exceeds by 17,320 tokens (14%)
145,320 / 1,000,000 — 854,680 tokens spare
145,320 / 1,000,000 — 854,680 tokens spare
145,320 / 1,000,000 — 854,680 tokens spare
145,320 / 1,000,000 — 854,680 tokens spare
145,320 / 1,000,000 — 854,680 tokens spare
Usable = context window × 80% — the remaining 20% is reserved for the model's answer.
Doesn't fit GPT-4o
- 1. Compress it to fit — question-aware compression, kept vs removed shown. Compress to fit GPT-4o →
- 2. Use a larger context model — switch to (1.05M) — fits.
- 3. Chunk it — split into 146 chunks of ~996 tokens each for RAG. Chunk for RAG →
- 4. Optimize — converting PDF to Markdown typically saves ~40-45% of tokens (layout noise removed). Optimize this PDF →
- 5. Summarize first — reduce to a fraction of the size before sending. Try Summary mode →
Per-page breakdown appears here for a single-PDF drop.
| Model | Input cost (1x) | Monthly (100 req) | Context used |
|---|---|---|---|
| GPT-5.6 Sol | $0.5813 | $58.13 | 13.8% of 1.05M |
| GPT-5.6 Terra | $0.2906 | $29.06 | 13.8% of 1.05M |
| GPT-5.6 Luna | $0.0291 | $2.91 | 13.8% of 1.05M |
| GPT-4o | $0.3633 | $36.33 | 113.5% of 128K |
| GPT-4o mini | $0.0218 | $2.18 | 113.5% of 128K |
| Claude Opus 5 | $0.7266 | $72.66 | 14.5% of 1M |
| Claude Sonnet 5 | $0.2906 | $29.06 | 14.5% of 1M |
| Gemini 3.1 Pro | $0.2906 | $29.06 | 14.5% of 1M |
| Gemini 3.7 Flash | $0.1090 | $10.90 | 14.5% of 1M |
| Llama 4 Maverick | $0.0392 | $3.92 | 14.5% of 1M |
Approximate — verified against each provider's official pricing page as of August 31, 2026. Providers change prices without notice; check their page before a billing decision.
What is File to Tokens?
File to Tokens extracts the text from a PDF, DOCX, TXT, or MD file and counts how many tokens it will use in an LLM's context window — the fixed budget every ChatGPT, Claude, or Gemini conversation is measured against. As a rule of thumb, 1 token is roughly 4 characters of English text, so a 10-page PDF runs around 6,000-8,000 tokens depending on formatting and density.
How many tokens is my PDF or DOCX?
| File type | Avg tokens / page | 10-page example |
|---|---|---|
| PDF, text-based | 500-800 | ~6,500 tokens |
| PDF, scanned (image) | 0 as text — 1,000+ vision tokens if sent as an image | OCR first |
| DOCX | 400-600 | ~5,000 tokens |
| TXT / MD | ~300 | ~3,000 tokens |
Averages for plain prose — dense tables, code, or non-English text run higher.
Will my file fit in ChatGPT or Claude's context window?
Every model reserves part of its context window for its own answer — sending a file that fills the window to 100% leaves no room to respond. The standard practice: usable tokens = context window × 0.8, keeping 20% free. A file fits comfortably when its token count is under that usable figure.
| Your file | 8K | 16K | 32K | 128K | 200K | 1M |
|---|---|---|---|---|---|---|
| 5,000 tokens | Yes | Yes | Yes | Yes | Yes | Yes |
| 12,000 tokens | No | Yes | Yes | Yes | Yes | Yes |
| 40,000 tokens | No | No | No | Yes | Yes | Yes |
| 150,000 tokens | No | No | No | No | Yes | Yes |
8K — Small/legacy tier — some local and older API models · 16K — Legacy GPT-3.5 16K tier · 32K — Mid-size legacy tier · 128K — GPT-4o · 200K — Legacy Claude 200K tier · 1M — Current frontier models — GPT-5.6, Claude Opus/Sonnet 5, Gemini 3.1 Pro. Current frontier models (GPT-5.6, Claude Opus/Sonnet 5, Gemini 3.1 Pro) sit near the 1M row; GPT-4o is the 128K row. Use the live fit checker above for your file's exact number against today's real models.
PDF native vs Markdown tokens — how to save ~44%
A PDF's text layer carries the same header and footer on every page, page numbers, watermarks, and tables held together by runs of spaces — all billed as tokens even though none of it answers a question. Converting to clean Markdown removes that layout noise: headings become #, bullets become -, and a table becomes a compact pipe-delimited grid instead of space-aligned columns. On a typical document that cuts token count by roughly 40-45%. Drop a PDF above and open the Optimization tab to see your file's real before/after number, or run it through PDF to LLM Optimizer directly.
Best practices to make a file fit in the context window
- Reserve 20% for the answer — never fill a context window to 100% with input alone.
- Convert PDF to Markdown first — typically a 40-45% token reduction over native PDF text.
- Strip images, running headers, and footers — they cost tokens and rarely carry the answer.
- Chunk for RAG — split a large file into overlapping windows (try 1,000 tokens per chunk with a page-boundary-aware split; adjust the size: ). Chunk for RAG →
- Use a bigger-context model when the file is simply large — GPT-5.6, Claude Opus/Sonnet 5, and Gemini 3.1 Pro all run ~1M tokens.
- Summarize first for very large documents, then send the summary plus your actual question.
How token counting works for files
Text is extracted first, then encoded. PDFs are read with pdf.js, rebuilding each page's lines from positioned text fragments. DOCX files are read with mammoth.js. TXT and MD are read directly. The extracted text is then run through the same tiktoken encoder (o200k_base for GPT-4o and GPT-5.6, cl100k_base as a close estimate for Claude, Gemini, and Llama) that Token Counter uses, so a file and pasted text always agree on the same model's count. A scanned PDF has no extractable text layer at all — see the OCR note above.
Related tools
- URL to Tokens — have a URL instead of a file? Scrape it and check its token count and context fit the same way.
- Token Counter — count tokens for pasted text across the same nine models.
- PDF to LLM Optimizer — clean a PDF, OCR a scan, and cut tokens before you send it.
- Docs to LLM — convert DOCX, PPTX, XLSX, MD, or HTML to clean Markdown and chunk it for RAG.
- Smart Token Reducer — strip whitespace, filler, and formatting waste from any text.
- Code to LLM — pack a codebase into one prompt with its own token count.