About token counting
This tool counts how many tokens your text uses for GPT-4 and GPT-3.5-Turbo, using the same cl100k_base tokenizer those models use. It also shows characters, words and sentences. It is handy for staying within a model context window and estimating API cost. It runs in your browser.
How Token Counter works
How to use it
- Paste or type your prompt or text.
- Read the live token count as you type.
- Trim the text if you need to fit a limit.
What is a token?
Language models do not read characters or words directly — they read tokens, which are common chunks of text (a token is roughly four characters of English, or about ¾ of a word). The model context limit and API pricing are both measured in tokens.
Why count tokens?
Knowing the token count helps you stay under a model context window, split long inputs, and estimate the cost of a request before sending it.
Common uses
- Count tokens for a GPT prompt
- Stay within a context window
- Estimate OpenAI API cost
- Check prompt length
- Trim text to a token limit
- Compare prompt sizes
- Plan chunking for long inputs
- Count tokens privately
Frequently asked questions
Which tokenizer is used?
cl100k_base — the tokenizer used by GPT-4 and GPT-3.5-Turbo.
Is my text uploaded?
No — tokens are counted in your browser.
How many characters is a token?
Roughly four characters of English, or about three-quarters of a word.
Does it match OpenAI exactly?
Yes for cl100k_base models; other models may tokenize slightly differently.
Why count tokens?
To fit context limits and estimate API cost.
Does it work for code?
Yes — it tokenizes any text including code.
Why is the first count delayed?
The tokenizer loads once, then counting is instant.
Is it free?
Yes — completely free with no sign-up.