LLM Tokenizer Visualizer (See How Text Splits into Tokens)
Paste text to see how an LLM splits it into tokens — each token highlighted with its boundary and index, plus the total count and estimated cost. Understand why your prompt costs what it does. 100% local.
Last updated:
CommentsPaste text to see exactly how an LLM breaks it into tokens — each token is highlighted with its boundary and index, and you get the total count. It shows why 'tokenization' or a rare name costs several tokens while 'the' costs one.
Exact BPE tokenization using OpenAI’s o200k_base — identical to tiktoken. The encoding table loads on demand and runs entirely in your browser; your text is never uploaded. Anthropic and Google use their own tokenizers, so their counts differ slightly from these.
What is Tokenizer Visualizer?
LLMs don't read characters or words — they read tokens, the subword pieces a tokenizer produces. This visualizer splits your text into those pieces and highlights each one so you can see the boundaries the model actually works with, plus the total count that drives your API bill and context-window budget. It uses a fast, dependency-free approximation of how Byte-Pair Encoding tokenizers (GPT's tiktoken, and similar vocabularies for Claude and Gemini) behave: common words stay whole, rare or long words split into subwords, and leading spaces and punctuation count too. For understanding tokenization and estimating cost it's ideal; for billing-exact counts, run your model's official tokenizer.
How to visualize tokenization
- 1Paste or type the text you want to inspect.
- 2Each token is highlighted inline with its position; read the total token count.
- 3Hover or scan the boundaries to see where long words split into subword tokens.
- 4Use the count to estimate prompt cost and check it against the context window.
Key Concepts
- What is a token
- The subword unit LLMs read and bill in — full guide to how tokenization works.
- Context window
- Why the token count matters for fitting a prompt into the model.
Tips & Best Practices
- ▸Minified JSON and dense code tokenize less efficiently than prose — the same information can cost more tokens.
- ▸Non-English scripts often use 2–3× more tokens per character because tokenizer vocabularies are English-centric.
- ▸For billing-exact counts use tiktoken (OpenAI) or the provider's official tokenizer; this tool is a close estimate.
Frequently Asked Questions
Is this an exact tiktoken tokenizer?
No — it's a fast, dependency-free approximation that splits on word, subword, and punctuation boundaries the way BPE tokenizers tend to. It's within a few percent of tiktoken for typical English and code and is ideal for understanding tokenization and estimating cost, but for billing-exact counts run the official tokenizer for your model.
Why does one word sometimes become several tokens?
BPE tokenizers keep common words as a single token but split rare or long words into subword pieces, and they count leading spaces and punctuation too. That's why 'tokenization' or an unusual name can be 2–4 tokens while 'the' is one.
Is my text uploaded?
No. Tokenization and highlighting run entirely in your browser; your text never leaves your device.
Try Next
Text Chunker
Split long text into overlapping chunks for embedding and RAG pipelines. Preview recursive, paragraph, sentence, or fixed strategies with live token counts. Runs 100% in your browser.
Related Tools
Prompt Template Tester
Write a prompt with {{variable}} placeholders, fill in values, and preview the final prompt. Detects every variable and flags any you left unfilled. 100% local.
Prompt Diff
Compare two versions of a prompt line by line and see the token delta between them — so you know exactly what changed and whether an edit made the prompt cheaper or more expensive. 100% local.
Embedding Cost Calculator
Estimate the cost of embedding a corpus — pick a model, enter the number of documents and average tokens each, and get the total token count and dollar cost. 100% local.
Vector Storage Calculator
Estimate how much memory or disk your embeddings need — enter vector count, dimensions, and precision (float32/float16/int8/binary) to see raw and indexed size. 100% local.
Prompt Cache Calculator
See how much prompt caching saves you. Enter your cached prefix size, per-request tokens, volume, and hit rate to compare cost with and without caching across models that support it. 100% local.
Batch API Cost Calculator
Compare real-time vs Batch API cost for a bulk job. Enter request count and per-request tokens to see how much the ~50% batch discount saves across models that support it. 100% local.