boxtool.io

Token Counter

Count tokens and estimate API costs for GPT-4o, Claude, Gemini and more. Free, private, runs in your browser.

0

Characters

0

Words

0

Tokens

Model

Cost Estimate

Assumed output length25% of input (0 tokens)

Input (0 tokens)

$2.5/1M tokens

< $0.001

Output (~0 tokens)

$10/1M tokens

< $0.001

Total estimated cost

input + output

< $0.001
Context window usage0 / 128,000 (0%)

Token counts are estimates. Actual counts may vary slightly from the model's native tokenizer. Prices sourced from official documentation and may change — always verify before production use.

Ad

Frequently Asked Questions

A token is the basic unit that language models use to process text. It can be a whole word, part of a word, a punctuation mark, or a space. On average, 1 token ≈ 4 characters or ¾ of a word in English. The exact tokenization varies by model — GPT models use BPE (Byte Pair Encoding), Claude uses a similar approach, and Gemini uses SentencePiece.

The counts are close approximations. Running the native tokenizer (tiktoken for OpenAI, etc.) requires WebAssembly which adds significant bundle size. Our estimates are typically within 2–5% of the real count for English text. For code, non-Latin scripts, or highly technical content, the variance may be slightly higher.

Cost = (input tokens / 1,000,000) × input price + (output tokens / 1,000,000) × output price. Input and output are billed separately by all major providers. The "output length" slider lets you model different response lengths — set it to the typical length of responses you expect from the model.

The context window is the maximum number of tokens a model can process in a single request — including both your input (prompt + conversation history) and the model's output. Once the context window is full, the model cannot process additional tokens. Models with larger context windows (like Gemini 1.5 Pro at 2M tokens) can handle much longer documents.

Prices shown are sourced from official provider documentation and are updated periodically. AI model pricing changes frequently — always verify current pricing on the official OpenAI, Anthropic, or Google Cloud pricing pages before making production decisions.

No. All token counting and cost calculation happens entirely in your browser using JavaScript. Your text is never sent to any server. You can use this tool offline once the page is loaded.