# How Do You Estimate the Token Count of a Text?

> A quick rule for a rough token count, where it fails, and how to get the closest count from the model provider, explained for your AI interview.

**In short:** Divide the characters by about four for a rough English estimate, which is fine for planning. For the closest number, use the model provider's own token counter on the full request, because models can split the same text differently.

AI and LLM interview question Q040, LLM fundamentals. Beginner, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-estimate-the-token-count-of-a-text

## Say it in 30 seconds

A quick guess is characters divided by four, because OpenAI says one token is about four English characters. That's good enough for planning. For the most accurate number, I call the provider's token counting endpoint on the whole request, not just my text, because the message structure and tool definitions add tokens too. Anthropic's docs still call that count an estimate, so I check the budget against real traffic after launch. And I recount whenever we change models.

## Say it in 2 minutes

A rough estimate is the first step, and it's quick. OpenAI's help page says one token is approximately four characters, or about three-quarters of a word. So a 4,800-character policy comes to around 1,200 tokens. I use that to plan before I write any code.

The guess has limits. The same page says these are estimates, not exact counts, and that other languages can have different relationships between characters, words, and tokens. Spelling and capital letters change the split too. So for anything that matters, like a budget or a context limit, I don't rely on the guess alone.

For the most accurate number, I use the provider's own counter. Anthropic's counter is free to use, but it has requests per minute limits, so I don't recount the same request again and again. It counts the whole request: system prompt, tools and messages. Its docs also say newer Claude models use a newer tokeniser, and the same input text can come out about 30 percent higher. The increase depends on the content and workload shape. So I recount on the model I plan to ship.

Anthropic's docs still call that count an estimate, so I check the budget against real traffic after launch. In an OpenAI Responses reply, input_tokens shows the input tokens that request really used, and I compare it with my estimate. If the gap keeps growing, my budget was wrong, so I fix the budget and keep the guess for planning only.

## What is a token count, in plain words?

A token is the small piece of text a model reads and writes. A token count is simply how many of those pieces a text makes, and it is not the same as a word count.

Think of a shipping clerk with a parcel. A quick weigh tells you roughly what is inside. A full count means opening the box and checking every item. The quick guess is characters divided by four. The most accurate count comes from the provider's own tokeniser, which splits the text the way that model does.

Why it matters: providers charge for tokens, and every model can only hold so many tokens at once. A support bot that answers 40,000 chats a day needs to know its tokens per chat, or the bill and the context limit both come as a surprise.

- **Token:** A piece of text the model reads or writes, such as a short word or part of a long one.
- **Tokeniser:** The part that splits text into tokens. Models can use different ones, and some share one.
- **Context window:** The most text a model can work with in one request, counted in tokens.
- **Counting endpoint:** A provider's own API call that returns the token count of a request, without writing an answer.
- **System prompt:** The developer's standing instructions at the top of a request. The user does not see them, but they still use tokens.

## Is there a quick rule, and how good is it?

Yes. OpenAI's rough rule for English text is that one token is about four characters, or three-quarters of a word. So 100 tokens are about 75 words. It works well for a first guess on plain English.

*Diagram, Two ways to count a text: Two ways in. The quick guess is fine for a plan. The provider's own count sets the budget, because it splits the text the way that model does.*
1. Divide the characters by about four.
2. Send the whole request to the provider's count call.
3. The guess gives a rough plan and a rough cost.
4. The provider's count sets the budget you ship with.

The rule breaks on other languages, unusual spellings and capitals, because a word can split into different tokens depending on its spelling, capitalisation and the text around it.

> "These are estimates, not exact counts." (OpenAI)

> **Tip:** A rule of thumb tells you the size. Use the provider's count for the bill.

## How do you get the most accurate count?

1. **Count the whole request:** Send the system prompt, tools, messages and images to the counter, not just your text. A plain-text count, which means counting only the words you typed, can leave parts of the request out.
2. **Use the model you will ship:** Models can split text differently, so recount on the exact model name in your code.
3. **Check real usage after each call:** An OpenAI Responses reply reports input_tokens, the input count that request used. Compare it with your estimate and fix the budget if the gap grows.
4. **Use a library only for plain text:** For plain text on your own machine, OpenAI's tiktoken library is a tokeniser built for its models. It is not a count of a full chat request.

> "The token count is an estimate." (Anthropic)
>
> "The same input text produces approximately 30 percent more tokens than on earlier models." (Anthropic)

Anthropic's counter is free to use, but it has requests per minute limits, so do not recount the same request over and over.

## What does one real support request look like?

Take a made-up support bot at a mid-size bank. It answers questions about card fees and refunds. Each chat sends three big pieces of text: policy snippets it looked up, the customer's message and the chat so far. The system prompt and the tool definitions add more on top.

*Diagram, What one support request sends: Several pieces of text join one request, and the provider counts all of them. A plain-text count of the customer's message misses the structure and the tools, so the count can come out higher.*
1. Snippets the search step found go in.
2. The customer's words go in.
3. Earlier turns go in again, so they add to every request.
4. Tool schemas count too.
5. The provider counts the whole request.

Using the rule, the three pieces come to about 1,950 tokens. The made-up count from the provider came to 2,310, which is 18 percent more. At 40,000 chats a day, the budget is 92,400,000 input tokens. The guess gives 78,000,000.

```python
# A support bot's token budget, with made-up numbers. The rule of thumb is only a first guess.
import math

CHARS_PER_TOKEN = 4  # OpenAI's rough rule for English text

# Made-up sizes, in characters, for one support chat.
pieces = {
    "policy snippets": 4800,
    "customer message": 600,
    "chat history": 2400,
}

def guess_tokens(chars):
    return math.ceil(chars / CHARS_PER_TOKEN)

total = 0
for name, chars in pieces.items():
    tokens = guess_tokens(chars)
    total += tokens
    print(f"{name}: about {tokens} tokens")

# Made-up: what a provider's count call might return for this request.
provider_count = 2310
print(f"rule of thumb total: {total}")
print(f"provider count: {provider_count}, {round((provider_count - total) / total * 100)}% more than the guess")
chats_per_day = 40000
print(f"daily input at the provider count: {provider_count * chats_per_day:,} tokens")
```

Output:

```text
policy snippets: about 1200 tokens
customer message: about 150 tokens
chat history: about 600 tokens
rule of thumb total: 1950
provider count: 2310, 18% more than the guess
daily input at the provider count: 92,400,000 tokens
```

So the rule is for planning, and the provider's count sets the budget. The guess is cheap, and it helps you see the shape of the cost before you spend on a count.

### How would you keep the budget honest when models change?

1. **Keep a fixed set of test requests:** Pick 20 real, anonymised requests from the support queue and keep them unchanged.
2. **Count them on every model change:** Run the counter on the same 20 requests before the switch and after it, and compare the totals.
3. **Alert when the numbers shift:** If the average input per chat moves by more than 10 percent, the budget and the context limit get a review before release.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A quick rule: about four characters per token for English.
- [ ] Where the rule fails: other languages, odd spelling and capitals.
- [ ] The most accurate count comes from the provider's counter, on the full request.
- [ ] Recount after a model change, since models can use different tokenisers.
- [ ] Budget with the provider's count, and check real usage after launch.

**Common traps**

- Trap: "One word is one token, so count the words." Better: Tokens and words differ. 100 tokens are about 75 English words, and other languages shift that.
- Trap: "The guess is good enough for the bill." Better: Use the guess to plan. Set the budget from the provider's count on the full request.
- Trap: "The old count still holds after we switch models." Better: Claude 4.7 and later models use a newer tokeniser, and the same input text can come out about 30 percent higher. Recount.

## Can you spot the mistake?

**Spot the mistake:** A teammate wrote four lines for a billing report. Which line should never set a bill?

A. tokens = len(text) / 4  # set the monthly bill from this
B. tokens = len(text) // 4  # quick estimate for the planning sheet
C. tokens = count_tokens(full_request)  # provider's count, before the call
D. tokens = usage.input_tokens  # reported by the reply, after the call

**Answer:** A. Characters divided by four is a planning guess, and it can be off for other languages and unusual spelling. The bill should come from the provider's count on the full request.

**Quick check:** A chatbot moves to a newer model family. What should you do with the token budget?

A. Keep the old count, because the text has not changed
B. Recount the same requests on the new model
C. Halve the budget to be safe
D. Ask users to write shorter messages

**Answer:** B. Tokenisers differ between model families. Newer Claude models can give about 30 percent more tokens for the same text, so recount on the model you ship.

## Can you answer these from memory?

**Flash cards**

- **What is the quick rule for English?** About four characters per token. 100 tokens is about 75 words.
- **Is the quick rule a precise count?** No. OpenAI says these are estimates, not exact counts.
- **Where does the rule break?** Other languages, unusual spelling and capitals.
- **Which count sets the budget?** The provider's count of the full request, for the model you ship.
- **What can a plain-text count miss?** Message structure, tools, schemas, images and files.
- **Why recount after a model change?** Newer Claude models can use about 30 percent more tokens for the same text.

## Likely follow-up questions

- Q003 What is a token, and why not whole words? https://designervenkat.online/interview/ai/what-is-a-token
- Q004 How do tokenizers like BPE, WordPiece and SentencePiece work? https://designervenkat.online/interview/ai/how-do-tokenizers-work-bpe-wordpiece-sentencepiece
- Q005 Why do token counts differ across languages and models? https://designervenkat.online/interview/ai/why-do-token-counts-differ-across-languages-and-models
- Q030 Why are input and output tokens priced differently? https://designervenkat.online/interview/ai/why-are-input-and-output-tokens-priced-differently
- Q105 How do you budget tokens for chat history? https://designervenkat.online/interview/ai/how-do-you-budget-tokens-for-chat-history
- Q324 How do you estimate token cost for a feature? https://designervenkat.online/interview/ai/how-to-estimate-token-cost

## Learn it in depth

- [Tokenization](https://designervenkat.online/learn/machine-learning/tokenization)
- [Tokens](https://designervenkat.online/learn/ai-engineering/tokens)
