Tokenizer and cost planner

Token counter for LLM prompts

Paste a prompt, document, JSON payload, or code snippet to estimate token count before sending it to an LLM. Tokenization can vary by provider and model, so StackLens separates exact OpenAI tokenizer modes from estimated modes.

Your text is processed in your browser and is not sent to a server.

Exact OpenAI tokenizer for pasted text.

Token count0
Counting modeExact
Characters0
Words0
Estimated input cost$0.0000
Context-window usage0 / 128,000 tokens

Input price per 1M tokens: $0.15

Pricing confidence: medium

Last checked: 2026-07-11

Source: related pricing page

Output cost: Output cost depends on generated output length.

Token preview

Token chunks

Exact decoded token chunks are shown for OpenAI modes.

How to use this token counter

Paste the prompt or payload you plan to send, choose the closest tokenizer mode, then compare token count, input cost, and context-window usage before you test in production.

Why token counts differ by model

Providers split text differently. Whitespace, CJK text, emoji, code blocks, JSON, and tool-call formatting can all change the final count.

How token count affects API cost

Input cost scales with pasted-token volume and request count. Output cost depends on generated output length, so this page does not infer it from pasted input.

Accuracy notes

Exact where possible, estimated elsewhere

OpenAI GPT-4o / GPT-4o mini uses o200k_base, and OpenAI GPT-4 / GPT-3.5 legacy uses cl100k_base. Claude, Gemini, and DeepSeek are estimates because this static site does not call official token-count APIs.

Estimation method

Planning estimate

Estimates are useful for planning. Exact billing may differ because providers tokenize text differently and APIs may add system, message, tool-call, or formatting tokens.

View pricing sources

Claude, Gemini, and DeepSeek estimated modesPlanning estimateChecked 2026-07-11

Estimated modes do not call official provider token-count APIs and should not be used as billing proof.

StackLens source-tracked pricing dataVaries by providerChecked 2026-07-11

Input cost estimates use src/data/models.json and should be verified against official provider pricing pages.

FAQ

Questions teams ask before choosing

Is this token counter exact?

OpenAI modes use exact OpenAI-style tokenization when the local tokenizer library is available. Claude, Gemini, and DeepSeek are estimated on this static page.

Why do different models have different token counts?

Different providers use different tokenizers. Code, JSON, Chinese text, emoji, whitespace, and mixed-language prompts can split differently.

Does StackLens send my text to a server?

No. The token counter processes pasted text in your browser.

Can token count estimate API cost?

Yes for planning. Input cost can be estimated from token count and source-tracked pricing, but final billing may include system, message, tool-call, output, and provider-specific tokens.

Why are Claude and Gemini marked as estimates?

The static page does not call official provider token-count APIs. Use official provider APIs or usage logs for billing-critical decisions.