Tiktokenizer

Current LLM tokenizer directory

LLM Tokenizer Support by Model

Find the correct token counter for current language models. This directory separates exact local tokenizers, compatible encoding views, documented character estimates and reference counts, with provider counting guidance for complete requests.

Accuracy note

Support labels describe the counting method, not model quality. Exact local means the published tokenizer is loaded directly. Local estimates use documented character heuristics and do not produce token IDs; reference counts belong to the named encoding. Provider usage remains authoritative for complete requests.

Facts checked against official sources on .

Which LLM Token Counter Should You Use?

Use the tokenizer or counting endpoint tied to the exact model and request structure you plan to send. A raw encoding can explain text boundaries, but chat roles, tool schemas, images, documents, cached content, and provider-side formatting can change the number reported by an API.

Tiktokenizer labels browser results as exact base text, compatible encoding, local estimate or reference encoding. No API key is needed for these local modes. Character estimates are oriented toward English text and can vary substantially for other languages, code and emoji.

Model or familySupport levelLocal method and request verification
GPT-6.1 SolLocal estimateAbout 4 English characters per token with an o200k_base reference view; OpenAI input-token count for gpt-6.1-sol requests
GPT-6 (Sol & Luna)Local estimateAbout 4 English characters per token; OpenAI input-token count for complete requests
GPT-6 SolLocal estimateAbout 4 English characters per token; OpenAI input-token count for gpt-6-sol requests
GPT-6 LunaLocal estimateAbout 4 English characters per token; OpenAI input-token count for gpt-6-luna requests
GPT-5.6Compatibleo200k_base view; confirm complete request usage with OpenAI
GPT-5.6 SolCompatibleo200k_base view; confirm complete request usage with OpenAI
GPT-5.6 TerraCompatibleo200k_base view; confirm complete request usage with OpenAI
GPT-5.6 LunaCompatibleo200k_base view; confirm complete request usage with OpenAI
GPT-OSS 20B & 120BCompatible base texto200k_base view; Harmony wrapper excluded
Claude Sonnet 5Local estimateEnglish character estimate with newer-tokenizer adjustment; Anthropic count_tokens for model-aware input
Claude Fable 5Local estimateEnglish character estimate with newer-tokenizer adjustment; Anthropic count_tokens for model-aware input
Claude Haiku 5.5Local estimateEnglish character estimate with newer-tokenizer adjustment; Anthropic count_tokens for Haiku requests
Gemini 3.6 FlashLocal estimateAbout 4 characters per token; Google models.countTokens for model-aware input
Gemini 3.5 FlashLocal estimateAbout 4 characters per token; Google models.countTokens for model-aware input
Grok 4.5Reference encodingLocal reference count; xAI TokenizeText for model-aware tokens
DeepSeek V4.1 FlashExact base textPublished V4.1 tokenizer; DeepSeek usage for the final request
DeepSeek V4 Pro & FlashExact base textPublished V4 tokenizer; include the message encoder for structured requests
DeepSeek V4 Flash (retired API)Exact base textPublished V4 tokenizer for the open weights; the deepseek-flash API name now serves V4.1 Flash
DeepSeek R1Exact base textPublished Hugging Face tokenizer
Kimi K3Exact base textPublished K3 vocabulary; Kimi API usage for complete XTML and multimodal requests
Qwen3Exact base textPublished Qwen/Qwen3-32B tokenizer; apply its chat template separately for conversations
MistralReference onlyMatch the Mistral checkpoint tokenizer and chat template; see the directory note below
LlamaReference onlyMatch the Llama checkpoint tokenizer and chat template; see the directory note below

GPT-5 and GPT-5.1 Tokenizer Searches

Searches for a GPT-5 tokenizer or GPT-5.1 tokenizer often omit the exact model snapshot and request format. Tiktokenizer does not treat the family name alone as a billing-exact specification. Use the current GPT-5.6 page for its labeled compatible encoding view, or select a raw encoding when you are intentionally comparing vocabularies.

For an API request tied to a particular OpenAI model ID, confirm the model in the current catalog and use the Responses input-token counting operation with the same structured input. This avoids implying that a generic GPT-5 label, a raw encoding, and complete API usage are interchangeable.

Search intentRecommended pathAccuracy boundary
Current GPT modelGPT-5.6 token counterCompatible local view; confirm API usage
OpenAI encoding comparisonTiktoken onlineExact for the selected raw encoding
Specific API model requestOpenAI input_tokens endpointCounts supported structured request input

How Tiktokenizer Defines Accuracy

  • Exact local tokenizer: the page loads the tokenizer artifacts published for the named open model and counts base text in the browser.
  • Compatible encoding: the page uses a known base encoding that is useful for inspection but does not claim to reproduce every provider-side wrapper.
  • Local estimate: a documented character heuristic estimates plain-text size without an API key. It does not reproduce token boundaries or IDs, and accuracy varies by language and content.
  • Provider API counting: use the named model's counting or tokenization endpoint and check its guarantees. Claude count_tokens returns an input estimate that can differ from actual Messages usage.
  • Reference encoding: a named raw encoding supplies a comparison count and IDs, without claiming to reproduce the selected model. Provider usage is the source of truth for the actual request.

Why Model-Specific Token Counts Differ

Token IDs belong to a vocabulary. The same text can produce different boundaries and counts across OpenAI, DeepSeek, Kimi, Grok, Gemini, Claude, Qwen, Mistral, and Llama models. A tokenizer update can also change the amount of text represented by a fixed context window.

Structured requests introduce another layer. System instructions, prior messages, function definitions, media inputs, reasoning, and special tokens may not appear in the text editor even though they contribute to request usage. For hard limits, cost estimates, or migrations, compare the local analysis with the usage returned by the target provider.

Mistral Token Counting

Choose the tokenizer supplied with your exact Mistral model checkpoint. The Mistral family name alone does not identify the tokenizer configuration or the chat template used by an inference service. This directory groups the counting guidance in one place; the browser's OpenAI encoding is only a comparison and is not an exact Mistral count.

For plain text, encode the unmodified prompt with the checkpoint tokenizer. For a conversation, apply that checkpoint's chat template to the complete message list, including roles and any supported tool definitions. Compare the resulting input length with the serving provider's reported usage before relying on it for a context limit.

Llama Token Counting

Use the tokenizer configuration shipped with the specific Llama checkpoint or fine-tune you run. A Llama family label does not guarantee identical token IDs, special-token settings, or conversation formatting across releases. The browser's comparison encoding does not provide an exact Llama count.

Keep the tokenizer revision and serving chat template aligned. Count raw text without adding a conversation wrapper only when that is the input you intend to measure. For chat, tokenize the rendered message list with the expected generation prefix, then check the provider's final usage for any additional request processing.

Tiktokenizer Reference Sources

Tokenizer behavior and model limits change. Verify production decisions with current provider documentation:

Frequently asked questions

Can one tokenizer count tokens for every LLM?

No. Token vocabularies, normalization rules, special tokens, and chat templates vary by model family.

What does exact base-text counting exclude?

It can exclude chat templates, tools, media inputs, provider-added formatting, and other request components outside the pasted text.

Which number should I use for billing?

Use the usage returned by the provider for the real request. A preflight tokenizer or count endpoint is planning data and may differ slightly from final billed usage.

Does Tiktokenizer upload prompts?

Local tokenizers, character estimates and reference encodings run in the browser without API keys. Provider API examples are separate methods and follow the provider's own data policies.