Skip to main content
Calcimator

LLM Token Calculator

Estimate token count and API cost from text length across different tokenizers (GPT-4, Claude, Llama).

Inputs

Results

Input tokens per request

1,250

Total API cost ($)

$0.02

Output tokens per request1,250
Total tokens per request2,500
Total tokens (all requests)2,500
Input cost ($)$0.00
Output cost ($)$0.01
128K context usage (%)1.95%
Tokenizer NameGPT-4 (cl100k_base)
How to Use This Calculator
  1. Enter the Text Length in characters — paste your typical prompt and count characters, or use a rough estimate.
  2. Select the Tokenizer matching your model (GPT-4 uses ~4 chars/token, Claude ~3.5 chars/token).
  3. Set the Input Price per 1M Tokens from the provider's pricing page and the Output-to-Input Ratio (e.g., 0.3 for summarization, 2 for generation).
  4. Enter the Number of Requests to estimate total batch cost.
  5. Review Input Tokens, Output Tokens, Total Cost, and Context Usage % to optimize your prompt length and budget.

How the result changes with Text length (characters)

Text length (characters)Input tokens per requestTotal API cost ($)
1,000,000250,000$3.00
3,500,000875,000$10.50
6,500,0001,625,000$19.50
9,000,0002,250,000$27.00

What each input means

Text length (characters)
Number of characters in your input text. Average English word is ~5 characters.
Tokenizer
Select the tokenizer
Input price per 1M tokens ($)
Cost per 1 million input tokens. GPT-4o: $2.50, Claude Sonnet: $3, GPT-4 Turbo: $10.
Output-to-input ratio
Expected output tokens as a multiple of input tokens. Summarization ~0.3, Q&A ~1, generation ~2+.
Number of requests
Total API requests to estimate cost for.

What each result means

Input tokens per request
Estimated input token count per request.
Output tokens per request
Estimated output token count based on the output ratio.
Total tokens per request
Input + output tokens consumed per request.
Total tokens (all requests)
Grand total token consumption across all requests.
Input cost ($)
Cost for input tokens across all requests.
Output cost ($)
Cost for output tokens (typically 3x input price).
Total API cost ($)
Combined input + output token cost.
128K context usage (%)
Percentage of a 128K context window used per request.

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    4 parameters
    Text length (characters) = 5000, Tokenizer = 0, Input price per 1M tokens ($) = 3, Output-to-input ratio = 1 = 5 input(s) provided
  2. Calculate Input tokens per request
    1250 = 1250
  3. Calculate Total API cost
    Total API cost = inputCost + outputCost
    0.015 = $0.015
  4. Calculate Output tokens per request
    Output tokens per request = ceil(inputTokens * outputRatio)
    1250 = 1250
  5. Calculate Total tokens per request
    Total tokens per request = inputTokens + outputTokens
    2500 = 2500

Engine last updated .

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Technology & Computing.