Free online tools to generate, calculate,
convert, format, encode, and play.
 

Token Counter

Estimate token counts and API costs for major AI models. Paste your prompt text to see how many tokens it uses and what it would cost across GPT, Claude, Gemini, Llama, and more.


0 Tokens (est.)
0 Words
0 Characters
Estimated API Cost
Model Input $/1M Output $/1M Input Cost Output Cost Total

How It Works

This tool estimates token counts using a regex-based tokenizer that approximates the behavior of byte-pair encoding (BPE) used by most large language models. It splits text into chunks using a pattern similar to GPT's cl100k_base tokenizer — separating words, numbers, punctuation, contractions, and whitespace into individual tokens.

The resulting count is an approximation. Actual token counts vary slightly between model families due to differences in their tokenizer vocabularies. For most English text, this estimate is within ~5-10% of the true count. Non-English text, code, and special characters may have larger variance.

API costs are calculated using each model's published pricing per million tokens. The input cost is based on the estimated tokens in your text, and the output cost uses the expected output token count you specify. Prices shown reflect standard (non-batch, non-cached) rates.


Embed This Util

You can embed this util on your own site as a widget. Adding ?embed=1 to the URL loads a compact version with just the tool itself; no header, menu, or documentation. Paste this snippet into your HTML:


    

Copy snippet Adjust the height to taste.



Feedback

Help us improve this page by providing feedback, and include your name/email if you want us to reach back. Thank you in advance.


Share with