Token Counter

Runs in browser

Estimate LLM token usage and input cost for GPT-4, Claude, and more.

Count approximate tokens for GPT-4, GPT-3.5, Claude, and Llama prompts. See words, characters, estimated input cost, and context usage before calling an API.

Token Counter tool

Tokens

59

Characters

235

Words

34

Input cost

$0.000295

ModelInput tokensInput costEst. output (2×)Output costTotal
GPT-4oselected59$0.000295118$0.001770$0.002065
GPT-4o mini59$0.000009118$0.000071$0.000080
GPT-459$0.001770118$0.007080$0.008850
Claude 3.5 Sonnet59$0.000177118$0.001770$0.001947
Claude 3 Opus59$0.000885118$0.008850$0.009735
Gemini 1.5 Pro59$0.000074118$0.000590$0.000664
Llama 3 70B59Free118FreeFree
Mistral Large59$0.000472118$0.002832$0.003304
Context window usage
59 / 128,000 (0.0%)

Approximate tokenization: ~1 token per 4 English characters. Models marked ≈ use GPT-4 tokenizer as approximation. Actual API counts may vary by ±5%.

🔒 Runs in your browser · No uploads · Your data never leaves your device

How to use

  1. Pick model

    Select GPT-4o, GPT-3.5, Claude Sonnet, or Llama 2 to apply model pricing and context limits.

  2. Paste prompt

    Token, word, and character stats update in real time while you edit.

  3. Check limits

    Use the context progress bar and warning to trim prompts before sending requests.

Common use cases

  • Checking prompt fits within context windowVerify a prompt doesn't exceed the model's token limit before sending the API request.
  • Estimating API cost before deploymentCalculate input tokens for a typical prompt to estimate per-call cost before scaling to production.

Examples

  • Code review prompt

    Typical engineering prompt.

    Input
    You are a helpful assistant...
    Output
    ~50 tokens (approx)

Frequently asked questions

Is this exact tokenization?
No. It uses a fast approximation (about 1 token per 4 characters for English).
Why estimate cost from input only?
Output token usage depends on model response length, which is unknown ahead of time.

Key concepts

Token
The basic unit of text an LLM processes — roughly 4 English characters or 3/4 of a word on average.
Context window
The maximum number of tokens an LLM can process in a single request, including both input and output.

You might find these useful too.

More ai tools