Token Counter
Estimate token counts for text (rough LLM tokenizer heuristic).
About the Token Counter
The Token Counter is a local, heuristic LLM token counter that estimates how many tokens any piece of text will consume before you send it to an API. Paste a prompt, an article, or a code snippet into the text area and the tool instantly reports four figures: an estimated token count, the word count, the character count, and a words-to-tokens estimate using the common words-divided-by-three rule. Below the stats, a cost table shows what the same token count would cost as input and output on GPT-4 and GPT-3.5, using their list prices per one million tokens, so you can price an inference request before spending anything. Because every byte stays in your browser, this chatgpt token counter is safe for proprietary prompts and internal drafts. Keep in mind it is an approximation: it combines a four-characters-per-token heuristic with the words/3 rule and takes the larger result, which lands within roughly 10–20% of most real tokenizers. That makes it ideal for quick prompt budgeting, context-window checks, and cost comparisons across models — not for exact billing.
Examples
The quick brown fox jumps over the lazy dog. Paste your text here to estimate token counts and LLM inference costs.
Est. tokens: 29 · Words: 21 · Characters: 115 · Tokens (words/3): 28 GPT-4 Input $0.00087 · Output $0.00174 · Total $0.00261 GPT-3.5 Input $0.00001 · Output $0.00004 · Total $0.00006
hello
Est. tokens: 2 · Words: 1 · Characters: 5 · Tokens (words/3): 2
To be, or not to be, that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles And by opposing end them.
Est. tokens: 52 · Words: 39 · Characters: 197 · Tokens (words/3): 52 GPT-4 Input $0.00156 · Output $0.00312 · Total $0.00468 GPT-3.5 Input $0.00003 · Output $0.00008 · Total $0.00010
How to use
- 1
Paste your text into the Text field — a prompt, an article, or code. The hint under the label updates live with the character and word counts.
- 2
Read the four stats: Est. tokens, Words, Characters, and Tokens (words/3). Est. tokens is the maximum of the two heuristics, so it stays conservative.
- 3
Check the cost table below the stats: each row shows Input, Output, and Total for GPT-4 and GPT-3.5 computed from the current estimate.
- 4
Edit the text and watch every figure re-calculate instantly — there is no submit button; the tool is fully reactive.
- 5
Remember the footer caveat: the estimate assumes roughly 4 characters per English token and real tokenizers can vary by 10–20%, so leave headroom when budgeting context windows.
Common use cases
- Budget API spend before an integration — estimate monthly token volume from representative prompts and multiply against the cost table.
- Check whether a prompt plus its expected answer fits inside a model's context window before deployment.
- Compare input-heavy versus output-heavy workloads across GPT-4 and GPT-3.5 pricing to choose the cheaper model.
- Estimate tokens for a batch of generated articles or product descriptions to forecast a content-pipeline bill.
- Sanity-check word counts against token counts when a client imposes a hard length limit on deliverables.
- Plan fine-tuning datasets — gauge how many tokens a training corpus of raw text represents before committing to a provider.
Best practices
- Treat the estimate as a planning figure, not an invoice: the 4-chars-per-token and words/3 heuristics can drift 10–20% from a real tokenizer, especially with code or non-English text.
- Budget prompts against the context window using the larger of the two heuristics — the tool already takes the maximum, so you stay conservative automatically.
- Check both the Input and Output columns when pricing: output tokens usually cost more (GPT-4: $60 vs $30 per 1M), and long generated answers multiply the output share of your bill.
- Paste the exact text you will send, including whitespace and formatting — leading spaces, line breaks, and markdown all consume characters and therefore tokens.
- For code or JSON, lean on the character-based heuristic: code tokenizes at closer to 3–4 chars per token than natural English, so the words/3 rule underestimates.
- Use the word count as a sanity check on content-length requirements (e.g. "max 500 words") while the token count validates the model-facing limit — they measure different things.
Tips
- The cost table assumes the same token count for input and output — for chat workloads the response is usually several times longer than the prompt, so budget output separately.
- Longer English words mean fewer characters per token; technical or academic text often tokenizes heavier than the 4-char heuristic predicts.
- Paste code verbatim including indentation — whitespace is real text, and trimming it gives you a falsely low estimate.
- Keep a representative "average prompt" saved somewhere and re-estimate it monthly as pricing pages change.
Frequently asked questions
Explore more misc tools
Browse the full collection of misc tools on the hub, or jump back to all categories.