All tools

BPE Token Calculator

Count tokens with js-tiktoken, visualize BPE splits, and estimate cost across major LLM models.

AI & Prompts
Privacy: 100% Client-Side. Your data never leaves this browser tab. Processing uses Web APIs and client-side libraries only.

Client-side BPE via js-tiktoken. Non-OpenAI models use an approximate encoding (noted below).

encoding=o200k_basecontext=128,000
Tokens
59
Characters
277
Bytes (UTF-8)
277
Context used
0.05%
Context window59 / 128,000
ModelInput costOutput cost*$/1M in$/1M out
gpt-4o · OpenAI$0.000148$0.0005902.510
gpt-4o-mini · OpenAI$8.85e-6$3.54e-50.150.6
claude-3-5-sonnet · Anthropic~$0.000177$0.000885315
claude-sonnet-4 · Anthropic~$0.000177$0.000885315
gemini-1.5-pro · Google~$7.38e-5$0.0002951.255
llama-3.1-70b · Meta~$4.13e-5$4.72e-50.70.8
deepseek-r1 · DeepSeek~$3.25e-5$0.0001290.552.19

* Output cost assumes the same token count as the prompt (estimate only). Pricing is approximate and may change.

You·are·a·helpful·assistant.↵↵Summarize·the·following·release·notes·for·engineers,·keep·it·under·120·words,·and·call·out·any·breaking·API·changes:↵↵-·Added·WebAuthn·passkeys·workbench-·JWT·workbench·now·supports·OIDC·JWKS·discovery-·HAR·analyzer·supports·waterfall·pagination

Why count tokens?

Large language models bill and truncate by tokens, not characters. Accurate counts help you stay inside context windows and estimate cost before calling an API.

stbox uses js-tiktoken in the browser to show live counts, visual BPE pieces, and a rough cost matrix across popular models.

How to use this tool

  1. Paste prompt or completion text into the editor.
  2. Pick a model encoding profile to refresh token pills and counts.
  3. Read context-window usage and estimated input/output costs.

Frequently asked questions

Are non-OpenAI counts exact?

OpenAI encodings are exact via tiktoken. Other vendors are approximated with compatible encodings for planning — always verify with the provider tokenizer for billing-critical work.

Is my data sent to a server?

BPE Token Calculator runs 100% in your browser. Inputs stay on your device and are not logged or stored by stbox servers.