Buy me a coffee
AI

Token Counter

Count tokens for any AI model and estimate API costs. No API key needed. Runs on your device — nothing is uploaded, nothing is stored.

Enter text to count tokens
About Token Counter

Token Counter tells you how many tokens a piece of text will cost before you send it to a model. Paste a prompt, a document, a system message or a chat transcript, pick a model, and the count updates as you type alongside the character and word counts and a rough price for sending it as input.

Tokens are the unit language models actually bill and budget in, and they don't line up with words. Whitespace, punctuation, code, emoji and non-Latin scripts all shift the ratio, which is why a 1,000-word prompt can be anywhere from 1,100 to well over 2,000 tokens depending on what's in it. Guessing four characters per token is fine until you're near a context limit or a per-request budget, at which point you want the real number.

Counting happens in the page. No API key, no account, no request to anyone.

Why this runs on your device

There is nothing confidential about the act of counting tokens, and it would be silly to pretend otherwise. What running locally actually buys you is different: the count updates as you type because there's no round trip, you don't need an API key or a billing relationship with anyone to find out how big your prompt is, and it works with no connection at all. The one genuine privacy note is about the text rather than the number — what people paste in tends to be a production system prompt or a real customer transcript, and that's not material you want to post to a stranger's server just to get an integer back.

How to use Token Counter
  1. Choose the model you're targeting.
  2. Paste or type your text into the box.
  3. Read the token, character and word counts.
  4. Check the estimated input and output cost for that model.
Limitations and trade-offs
  • Only one real tokenizer runs here: OpenAI's o200k_base. That makes the GPT-4o and GPT-4o mini counts exact. The Claude, Llama 3.3 and Gemini figures are that same count multiplied by a fixed adjustment factor — an approximation, not those vendors' own tokenizers. Treat non-OpenAI numbers as a ballpark, and expect the gap to widen on code, emoji, and non-Latin scripts, which is exactly where tokenizers disagree most.
  • The model list is short and current-generation. Older OpenAI models such as GPT-4 and GPT-3.5 use a different encoding (cl100k_base) that isn't selectable here, so counting them against this list will be off.
  • The cost figure comes from a price table stored in the app, so it's only as current as the last time that table was updated — providers change prices, and this will not notice. It's also text-only: images, audio, cached-input discounts, batch pricing and fine-tuned rates are not modelled.
  • It counts the text you paste and nothing else. A real API call also spends tokens on the system prompt, tool and function definitions, prior conversation turns, and the model's own response — so your actual bill will be higher, often much higher for a long chat.
Frequently asked questions