Claude-compatible approximation
We use cl100k_base as an accessible browser-side approximation. Treat it as a planning signal rather than an API billing receipt.
Count text tokens with a Claude-compatible approximation and estimate API cost locally.
Local token pieces update 0.5 seconds after you stop typing.
Paste text above to see how the selected local encoder splits it into tokens.
Local calculation. Your text stays in this browser. Nothing is uploaded or stored by Tokens Calculator.
We use cl100k_base as an accessible browser-side approximation. Treat it as a planning signal rather than an API billing receipt.
The calculator code runs on-device. You can measure sensitive prompt drafts without sending the content to Tokens Calculator.
The selected input or output rate is shown beside every estimate and links to the provider’s pricing documentation.
Claude models use provider-specific tokenization and API message formatting. This static tool deliberately keeps every calculation local, so it exposes the compatible cl100k_base result rather than claiming an exact Anthropic billing total.
Paste the text you plan to send to or receive from a Claude model.
Select Claude 3.5 Sonnet or Claude Sonnet 4.6 to use its configured list price.
Review the local cl100k_base token approximation and choose the input or output cost mode.
This calculator uses cl100k_base as a practical Claude-compatible approximation. It is useful for planning, but Anthropic’s tokenizer and message formatting can produce a different exact count for a specific model or API request.
Yes. Your text is tokenized in the browser with gpt-tokenizer. Tokens Calculator does not send the text to a server, database, model provider, or analytics endpoint.
The tool multiplies the displayed token count by the selected model's configured USD list price per million input or output tokens. Prompt caching, tools, long-context premiums, discounts, and taxes are not included.
Pricing and model availability change over time. The selector includes a Claude 3.5 Sonnet legacy reference and a Claude Sonnet 4.6 reference so you can plan a historical or current workload.
Every tool runs token counting in your browser. Keep your text local while you move between calculators and guides.
Not affiliated with Anthropic, OpenAI or Google.