Skip to main content
tokenmath
Menu

About

A small, opinionated tool.

tokenmathis a calculator for two questions every team building with Anthropic Claude, Google Gemini, or OpenAI's GPT family ends up asking: how many tokens is this prompt, and what is it going to cost? It exists because answering those questions shouldn't require pasting your prompt into someone else's server.

How it works

When you paste text into the calculator, the page tokenizes it locally — in JavaScript, on your browser, using the same kind of byte-pair encoders the model vendors use. For inputs longer than 50,000 characters, the work moves to a Web Worker so the page stays responsive. The number you see is computed on your machine and multiplied by the per-million pricing the vendor publishes.

OpenAI ships a canonical client-side tokenizer (o200k_base), so GPT-5 and GPT-4.1 counts are exact. Anthropic and Google don't publish current client tokenizers, so we approximate Claude with cl100k_base and Gemini with o200k_base, applying per-model calibration to nudge the result toward the vendor counts. In practice the drift is ±2–3% on typical English and code; treat those numbers as budgeting estimates, not billing reconciliations.

What we promise

Built by

tokenmath is part of the Vertex Network — a small set of developer + creator tools sharing a common stack and design language. For a running list of what's shipped, see the changelog.

Keyboard shortcuts

Press ? any time to reopen this list.

Show this overlay?
Toggle themet
Focus the prompt textarea/
Go to homegh
Go to modelsgm
Go to pricing datagp
Go to changeloggc
Go to aboutga
Close overlays / dialogsEsc