# Token Counter for GPT, Claude, Gemini and Llama

> Count tokens with the real BPE vocabulary, see every token coloured in place, and compare the count across models.

This token counter runs the real byte-pair-encoding vocabulary in your browser: o200k_base for GPT-4o and later, cl100k_base for GPT-4 and the embedding models. It shows the exact token count, every individual token highlighted in place, characters per token, and the same text measured against Claude, Gemini and Llama. Nothing you paste is uploaded.

**URL:** https://convertto.tech/t/llm-token-counter
**Category:** AI & LLM Tools (https://convertto.tech/c/ai-tools)
**Privacy:** Runs entirely in the browser; no upload
**Cost:** Free, no sign-up
**Last updated:** 2026-08-01

## Key facts

- **Exact for:** o200k_base and cl100k_base — the published OpenAI vocabularies
- **Estimated for:** Claude, Gemini, Llama, Mistral and DeepSeek — no published vocabulary
- **Typical English:** ~4 characters per token
- **Typical JSON or code:** ~2.5 characters per token
- **Privacy:** Runs entirely in your browser — nothing is uploaded
- **Cost:** Free, unlimited, no sign-up

## How to use

1. Enter or paste your text.
2. Choose the tokeniser.
3. Turn "Show every token" on or off as needed.
4. Press Run, then download the result when it is ready.

## FAQ

### Why is the token count different from characters ÷ 4?

Because ÷ 4 is an average over English prose and nothing else. Whitespace-heavy code, JSON keys, UUIDs, base64 and any non-Latin script all tokenise far more densely — 2 to 2.5 characters per token is common — so the shortcut can under-count a payload by 40%.

### Is the Claude token count exact?

No, and it says so. Anthropic does not publish Claude's vocabulary, so the figure here is a calibrated estimate — usually within a few percent on prose, less accurate on code. For a billing-exact number call the count_tokens endpoint, which is free.

### Does my text get uploaded?

No. The vocabulary file is downloaded to your browser and the encoding runs locally. That matters here more than on most tools, because the thing people most want to count is a production prompt.

### Why do two models give different counts for the same text?

Each model family trained its own vocabulary. A word that is one token in o200k might be three in an older 32k vocabulary, and the same document can differ by 30% between tokenisers — which is why a prompt that fits one model's context window may not fit another's.

## Sources

- [OpenAI — tokenizer and BPE vocabularies](https://github.com/openai/tiktoken) — OpenAI
- [Anthropic — token counting endpoint](https://platform.claude.com/docs/en/build-with-claude/token-counting) — Anthropic
- [Google — Gemini token counting](https://ai.google.dev/gemini-api/docs/tokens) — Google

## Related tools

- [Context Window Calculator](https://convertto.tech/t/context-window-calculator): Paste a document and see which models it fits inside, how much of each window it fills, and what is left for the reply.
- [Words to Tokens Converter](https://convertto.tech/t/words-to-tokens-converter): Convert between words, characters, pages and tokens using measured ratios for prose, code, JSON and CJK.
- [LLM Model Comparison](https://convertto.tech/t/llm-model-comparison): Every current model side by side: price per million tokens, context window, max output, modalities and cache rates.
- [Chat Export Formatter](https://convertto.tech/t/chat-export-formatter): Drop in an exported conversations file and get clean Markdown, HTML or plain text — one document per conversation.
- [Prompt Injection Sanitizer](https://convertto.tech/t/prompt-injection-sanitizer): Strip invisible carriers, neutralise instruction-like markup and fence untrusted content before you paste it into a prompt.
- [AI API Cost Calculator](https://convertto.tech/t/ai-api-cost-calculator): Work out what a prompt costs per call, per day and per month, and compare the same workload across every major model.
- [LLM Stream Parser](https://convertto.tech/t/llm-stream-parser): Paste a raw server-sent-event stream and get the reconstructed message, tool calls, usage and stop reason.
- [Prompt Template Generator](https://convertto.tech/t/prompt-template-generator): Write a prompt once with placeholders, paste rows of data, and get every filled prompt back with its token count and cost.
