AI Prompt Builder
Structure prompts with a role, task, context, constraints, output format and examples, with reusable variables.
Count the tokens in a prompt or document before you send it. Get exact counts for OpenAI models and Llama 3, clearly labelled estimates for Claude and Gemini, a context-window check and a cost estimate.
| Model | Tokens | Context used | Input cost |
|---|
How it works
Paste your prompt or document, or drop in a text file.
Pick a model. The count, context-window usage and cost update as you type.
Turn on token view to see exactly where the text is split.
About this tool
Language models don't read characters or words; they read tokens, chunks of text from a fixed vocabulary. In English a token averages about four characters or three-quarters of a word, but code, numbers and other languages split differently. Tokens determine what you pay, how much fits in a model's context window and how long a response can be.
Each model family has its own tokenizer, so the same text gives different counts. OpenAI's (o200k_base for GPT-4o and the o-series, cl100k_base for GPT-4 and GPT-3.5) and Meta's Llama 3 tokenizers are public, so this tool runs them in your browser for exact counts. Anthropic and Google don't publish theirs, so Claude and Gemini counts are estimates; their APIs offer exact token counting endpoints when you need precision.
Real o200k, cl100k and Llama 3 tokenizers, not character guesses.
Colour-coded token boundaries show how your text is split.
Input and output cost from an editable price table.
Tokenizing runs in a background worker, so long documents don't freeze the page.
FAQ
About 750 English words. Code, non-English text and text with lots of numbers or symbols use more tokens per word.
No, they're estimates, because Anthropic and Google don't publish their tokenizers. Expect them to be within roughly 10–20% for typical English text. Use the providers' token counting APIs for exact numbers.
GPT-4o uses the larger o200k_base vocabulary, which packs more text into each token, especially for non-English languages.
Prices change often. The table shows the date it was last checked, and you can edit any price to match your plan.
No. Everything you type is processed in your browser and never leaves your device. Drafts are saved only in this browser's local storage so you can come back to them.
Missing something?
Instant.tools grows from real requests. Describe the task you're stuck on and we'll consider building it next.