Prompt Token Budgeter

Allocate your LLM context window across System, User, and Assistant roles with real-time token counting. Visualize your budget, avoid silent truncation, and optimize API costs — all locally, with no cloud API calls.

AI Workflows & Technical Writing Local processing Your prompts stay in your browser. Nothing is uploaded.

Tool interface

0 tokens
0 tokens
0 tokens
100%
System User Assistant Remaining

About this tool

This tool uses a JavaScript-based tokenizer that approximates tiktoken's behavior for common LLM models. It counts words, punctuation, and special tokens to provide reasonably accurate estimates for budgeting purposes. For production use with strict token limits, verify counts using the official tokenizer for your model.

Introduction

LLM APIs have strict context window limits. Exceeding them causes silent truncation, wasted API calls, or unexpected behavior. This tool helps you allocate your token budget across System, User, and Assistant roles with real-time feedback.

How it works

  • Select your target model or specify a custom context window.
  • Paste or type your System prompt, User message, and expected Assistant response.
  • The tool counts tokens in real-time and shows a visual budget allocation.
  • Warnings appear if you exceed the context limit or leave too few tokens for the response.

Token counting method

This tool uses a heuristic tokenizer that approximates tiktoken's behavior:

  • Words are split on whitespace and punctuation boundaries.
  • Common words count as 1 token; longer words may split into subword tokens.
  • Special characters and numbers are counted individually.
  • Message formatting overhead (role markers, separators) is estimated.

For exact counts, use the official tokenizer (e.g., OpenAI's tiktoken library or Anthropic's tokenizer).

Supported models

  • GPT-4 / GPT-4 Turbo: 8,192 tokens (standard), 32K and 128K variants available.
  • GPT-3.5 Turbo: 16,385 tokens.
  • Claude 3: 200,000 tokens (Haiku, Sonnet, Opus).
  • Llama 3: 8,192 tokens (8B and 70B variants).
  • Custom: Specify your own context window size.

Privacy

All processing happens in your browser using deterministic JavaScript. There is no upload, no account, no API key, and no remote model. Your prompts never leave the page.

FAQ

How accurate is the token count?

This tool uses a heuristic tokenizer that approximates tiktoken. It's typically within 5–10% of the actual count for English text. For production use with strict limits, verify with the official tokenizer.

Why does my prompt get truncated?

Most LLM APIs silently truncate prompts that exceed the context window. Always leave a buffer (10–20%) for the response and formatting overhead.

How many tokens should I reserve for the response?

Depends on your use case. For short answers, 500–1,000 tokens. For long-form generation, 2,000–4,000 tokens. Always test with your actual prompts.

Related tools

References

Version and changelog

  • Version: 1.0.0
  • Last updated: August 12, 2026
  • Changelog: Initial production release.