hackerdb

Home / Free tools / GPT token counter (estimate)

GPT token counter: estimate tokens in a prompt or document

Paste the text you are about to send (or a document you want to summarise). The tool estimates tokens with a cl100k / o200k-style heuristic, shows characters and words, and checks common context windows. It is not OpenAI’s tokenizer and it does not price a request — use the token cost estimator for that.

How to use it

  1. Paste the text you will actually send. A system prompt, a document, a transcript, or all of them together if they go in one request.
  2. Reserve space for the reply if it must fit in the same window. A long answer needs headroom on smaller context windows.
  3. Read the estimate as a range. It is close enough to see whether you should cut the prompt, not close enough to audit a bill.
  4. For money, use a cost estimator and your vendor’s rate card. This page does not multiply tokens by a price.

Why a counter that is not a tokenizer is still useful

Vendors bill and truncate in tokens, not words. A 3,000-word brief can be 4,000 tokens or 6,000 depending on punctuation, code and language. You do not need a perfect count to decide whether a document will fit in an 8k window, or whether you should summarise it first. You do need a perfect count if you are reconciling an invoice — this page is not that. Official tokenizers (tiktoken for many OpenAI models, or the vendor’s own library) are the source of truth, and they change when the vocabulary changes.

What usually inflates a count

The Usage & Cost-Reduction Guide on hackerdb Labs is about the habits around this: shorter prompts that keep the result, routine frequency, and a monthly usage review. There is also a Cost Audit & Model Routing Playbook if you are comparing models, not just counting one prompt.

Worked example

This is what the tool produces for the sample input, so you can see the result without running it.

Input

You are a careful editor. Shorten the following memo to six bullet points, keep every number, and flag anything that is an opinion rather than a fact.

MEMO
The team shipped version 2.1 on 12 November. Support tickets fell 18% week on week, but three enterprise accounts still report a timeout when they export more than 50,000 rows. Please decide whether we hotfix this week or wait for 2.2 on 4 December.

Result

Estimated 188 tokens in the pasted text, plus 500 reserved for a reply, is about 688 tokens in the window.

MeasureCount
Characters (including spaces)406
Words72
Lines4
Estimated tokens188
Characters per estimated token2.16
Estimated tokens per word2.61
Context windowSizeIf you send this text + reserved reply
GPT-3.5 / older 4k models4,096 tokensFits, ~3,408 left
8k context8,192 tokensFits, ~7,504 left
16k context16,384 tokensFits, ~15,696 left
32k context32,768 tokensFits, ~32,080 left
GPT-4o / 4.1 class (128k)128,000 tokensFits, ~127,312 left
200k-class models200,000 tokensFits, ~199,312 left

This is a heuristic, not tiktoken or a vendor tokenizer. English usually lands near four characters per token; code, URLs and CJK can differ. Counts can be off by roughly 10–20%. It does not know your model’s exact vocabulary, and it is not a price — pair it with the token cost estimator if you have a published rate per million tokens.

Frequently asked questions

Is this the same as OpenAI’s tokenizer?

No. It is a local estimate. For exact counts, use the vendor’s tokenizer or a library such as tiktoken for the models it supports.

Does it cover Claude, Gemini or Grok?

The estimate is in the same ballpark for English, but every model has its own vocabulary. Use this to see if something is large, not to compare vendors to the token.

Why is this separate from the cost estimator?

That tool prices a run from a token count and a rate card. This one starts from raw text.

Is the text uploaded?

No. It never leaves your browser.

More free tools

All free tools