Both OpenAI and Anthropic give you a way to count tokens before you send anything. They work differently, and what each one counts isn't quite the same, so it helps to know which tool fits the job.
For a quick look: the Tokenizer
OpenAI's help page points to a web tool called the Tokenizer. It shows how a piece of text is divided into tokens.1
That's useful for getting a feel for the unit. Check the first page on tokens if the word is new to you.
Before you paste anything into a web tool, think about what's in it. Customer details and secrets such as passwords or keys stay out unless your workplace policy allows them. Sample text works fine.
For a whole request: the counting interfaces
Plain text isn't the full picture. OpenAI says a plain-text count doesn't necessarily include all the tokens in an API request. Message structure, tools, schemas, images and files can all add to the full input count.1
So both makers offer counting interfaces for developers.
- OpenAI has an input-token counting interface for the Responses API. It accepts messages, images, files, tools and conversations, and its count includes formatting tokens used for structure, such as message roles.1
- Anthropic has a token counting interface for its Messages API. It takes inputs like those you'd use to create a message, including system prompts, tools, images and PDFs, and returns the total number of input tokens.2 It doesn't accept every request the Messages API does: server tools such as web search and the MCP connector return an error, and images and PDFs must be sent as base64 to be counted. For those requests, the usage field in the response reports the tokens used.2
If you don't write code, these are for whoever builds or maintains your business's tools. You can still pass this page to them.
Does counting cost anything?
OpenAI says counting with its input-token interface is free and doesn't use the model's normal quota. A later request to generate a reply is billed separately.1
Anthropic says token counting is free to use, but it's subject to requests-per-minute rate limits based on your usage tier.2 The pages were checked on 10 November 2026, and terms can change, so read the current page before relying on this.
What a count can't tell you
Two limits are worth knowing.
- It's an estimate. Anthropic's page says the token count is an estimate, and the real number might differ by a small amount.2
- It covers input only. OpenAI says an input count doesn't predict how many output tokens the model will generate.1 That matters for cost, because replies are counted and priced too. Token-based pricing has the detail.
Count with the model you'll actually use
Models can split text differently. Anthropic's page warns that when migrating from an older model, you shouldn't reuse token counts measured on it. It tells readers to count prompts with the model ID they plan to use.2
After you send
Counting before is a forecast. The usage report is the result. Anthropic says every response reports what the request consumed in its usage field.3 OpenAI tells readers to inspect the usage information after a request, and says the field names vary by endpoint.1
Compare the forecast with the report on a few real jobs. If they're close, you can trust your counting habit. If they're not, find out why before you scale up.
What to do with the number
- Compare it with your model's window and output limit on the maker's page. The page on why replies stop short explains both.
- Leave a margin. Estimates are estimates.
- If the prompt is too large, shorten it, remove repeated context or split it. OpenAI's page lists these same steps.1
For a very rough size without any tool, the words-to-tokens rule of thumb will do for planning.
Cited material
- Understanding and counting tokens, OpenAI Help Center
- Token counting, Anthropic (Claude Platform Docs)
- Context windows, Anthropic (Claude Platform Docs)