Token Calculator for LLMs

Estimate token usage and API costs for OpenAI, Anthropic, Google, Meta, and more. Understand your prompt costs before you run them.

Paste text or file here

0 words0 characters
Upload File (.txt, .md, .csv)

Result Statistics

Tokens0
Words0
Characters0

Cost Estimation

Estimated CostBased on 0 tokens
$0.000000

What is a token calculator?

A token calculator helps developers and businesses estimate the cost of using Large Language Models (LLMs) like GPT-4, Claude, or Gemini. Models process text in chunks called "tokens", not words or characters. A token is typically around 4 characters in English, or about 0.75 of a word.

By pasting your prompt into our calculator, we use the specific tokenization logic (like OpenAI's cl100k_base) to give you an exact count. We then apply the latest per-million token pricing from the model providers to give you an accurate cost estimation before you execute your API calls.

How to use the token calculator

  • 1
    Paste your text: Copy and paste your prompt, code, or document into the large text area above.
  • 2
    View exact token counts: The tool instantly processes your text and displays the exact token count.
  • 3
    Calculate API costs: Select your target provider and model in the right sidebar to see exactly how much the request will cost.

Compare Token Costs

A comprehensive breakdown of pricing across major LLM providers. Prices are per 1 Million tokens.

ProviderModelContext WindowInput Cost (/1M)Output Cost (/1M)TokenizerTraining Data
O
OpenAI
GPT-4o128K$5.00$15.00cl100k_baseOct 2023
O
OpenAI
GPT-4 Turbo128K$10.00$30.00cl100k_baseDec 2023
O
OpenAI
GPT-48K$30.00$60.00cl100k_baseSep 2021
O
OpenAI
GPT-3.5 Turbo16K$0.50$1.50cl100k_baseSep 2021
A
Anthropic
Claude 3.5 Sonnet200K$3.00$15.00ClaudeApr 2024
A
Anthropic
Claude 3 Opus200K$15.00$75.00ClaudeAug 2023
A
Anthropic
Claude 3 Sonnet200K$3.00$15.00ClaudeAug 2023
A
Anthropic
Claude 3 Haiku200K$0.25$1.25ClaudeAug 2023
G
Google
Gemini 1.5 Pro2M$3.50$10.50GeminiEarly 2024
G
Google
Gemini 1.5 Flash1M$0.07$0.30GeminiEarly 2024
G
Google
Gemini 1.0 Pro32K$0.50$1.50GeminiEarly 2023
M
Meta
Llama 3 (70B)8K$0.50$0.50Llama 3Mar 2024
M
Meta
Llama 3 (8B)8K$0.05$0.05Llama 3Mar 2024
M
Mistral
Mistral Large32K$4.00$12.00MistralLate 2023
M
Mistral
Mixtral 8x22B65K$0.90$0.90MistralLate 2023
C
Cohere
Command R+128K$3.00$15.00CohereEarly 2024
C
Cohere
Command R128K$0.50$1.50CohereEarly 2024

Token Calculator FAQ

How accurate is the token count?

For OpenAI models, we use the exact `cl100k_base` tokenizer, meaning the count is 100% accurate. For Anthropic and Google, we use highly tuned heuristics as their tokenizers are proprietary. Expect ~95% accuracy for non-OpenAI models.

Are prices automatically updated?

We regularly review and update the pricing table to reflect the latest API costs from major providers. However, for large-scale production workloads, always verify against the provider's official pricing page.

What is a Context Window?

The context window represents the maximum number of tokens a model can process in a single request. This includes both your input prompt and the model's generated output.

Is my data sent to any servers?

No. The token calculator processes all text entirely within your browser using client-side JavaScript. Your prompts and sensitive data are never transmitted to our servers.