Tokens Calculator

Claude Token Calculator

Count text tokens with a Claude-compatible approximation and estimate API cost locally.

cl100k_base
0 / 1,000,000 characters

Token visualization

Local token pieces update 0.5 seconds after you stop typing.

0 tokens

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.

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.

Your text stays private

The calculator code runs on-device. You can measure sensitive prompt drafts without sending the content to Tokens Calculator.

Costs are transparent

The selected input or output rate is shown beside every estimate and links to the provider’s pricing documentation.

Why the count is an estimate

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.

How it works

  1. 01

    Paste the text

    Paste the text you plan to send to or receive from a Claude model.

  2. 02

    Choose a Claude model

    Select Claude 3.5 Sonnet or Claude Sonnet 4.6 to use its configured list price.

  3. 03

    Read the estimate

    Review the local cl100k_base token approximation and choose the input or output cost mode.

Claude Token Calculator FAQ

How accurate is this Claude token calculator?

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.

Is my text processed locally?

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.

How is the Claude API cost estimated?

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.

Why offer more than one Claude model?

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.

Not affiliated with Anthropic, OpenAI or Google.