Token Counter
Count the tokens in text, Word or PDF for GPT (exact) and Claude (estimated), with context window and cost.
Or upload a .txt, .md, .docx or .pdf file
Before you paste it into an AI
How many tokens does my text have for ChatGPT or Claude?
To find out how many tokens a text has, paste it here or upload a .txt, .md, .docx or .pdf file: Docuboxer counts GPT tokens with OpenAI's real tokenizer (o200k_base for GPT-4o, GPT-4.1 and GPT-5, and cl100k_base for older models) and gives an estimate marked "≈" for Claude. It then compares how much of each model's context window your text fills and what it would cost to read, using input prices checked in October 2026. Everything is calculated in your browser: your text or file is never sent to a server, it is free, and it needs no signup. Use it to check that a document fits in a prompt, to trim it before paying for it, and to pick the cheapest model that can handle it. If your file is a Word document or a PDF, the tool pulls the text out for you and counts only that text: it does no OCR and doesn't count image tokens.
How to use Token Counter
- Paste your prompt, document or code into the text box, or drag a .txt, .md, .docx or .pdf file onto the upload area. The text is read in your browser.
- Read the exact GPT count in o200k_base and cl100k_base, and the estimated Claude range, which always carries a "≈" because Anthropic doesn't publish its tokenizer.
- Check the model table: each row shows the tokens, the context window, the percentage you fill and the input cost. Rows in red mean the text doesn't fit.
- If you are over, trim the text or convert it to Markdown with the tools below (a Word or PDF turned into Markdown often uses fewer tokens than loosely formatted text).
- Copy the summary with the "Copy" button if you want to paste it into a report or a conversation.
Common use cases
Checking a contract or report fits in the prompt
Upload the .docx or PDF and see at once whether it fits whole in GPT-4o's 128,000-token window or needs a model with more context, before pasting it and getting an error.
Estimating the cost of processing many documents
Count the tokens of a typical document, multiply by the number of files and get the input cost at each model's price, without opening an API account.
Picking the cheapest model that can handle it
The table puts Claude Haiku, Sonnet, GPT-4.1 and GPT-5 side by side with context percentage and cost, so you can decide whether a smaller model is worth it.
Trimming a long system or RAG prompt
Paste the prompt, see how many tokens each version uses, and cut what you don't need until you are inside your context budget.
Preparing a chat with your own data
Before pasting a long email, meeting minutes or source code into ChatGPT or Claude, check that you won't fill the window and leave no room for the answer.
Frequently asked questions
How do I count tokens for ChatGPT?
Paste the text into the tool and read the o200k_base count, the tokenizer of GPT-4o, GPT-4.1 and GPT-5. It is the same algorithm tiktoken uses, so the number matches OpenAI's. For GPT-4 and GPT-3.5, look at the cl100k_base count.
Why is the Claude count an estimate?
Anthropic doesn't publish Claude's tokenizer, and an exact count only comes from calling its API with a key. Docuboxer makes no outside calls, so it starts from the GPT count and applies a factor. It is only a guide: on code and tables the error can be 25% or more. Also, Claude 4.7 and later models produce about 30% more tokens than earlier ones for the same text.
How many tokens is 1,000 words?
In English, 1,000 words is roughly 1,300 tokens. Other languages usually take more because words are longer or carry accents. It's only a rule of thumb: the reliable way is to paste your text and count it.
What happens if my text doesn't fit in the context window?
The model rejects the request or cuts off the answer. Trim the text, split it into parts, summarize the less important bits or choose a model with a larger window. The table marks in red the models where it doesn't fit.
Are the prices and context windows accurate?
They are the ones OpenAI and Anthropic published on October 6, 2026, with a link to the source under the table. Providers change prices often, so check the official page before budgeting. The cost shown is input only: the reply is billed separately.
Is my document uploaded anywhere?
No. The text is counted by a library running in your browser, and .docx and .pdf files are read locally too. You can verify it in the Network tab of your developer tools: no request carries your content.