Tokens

AI & LLM fundamentals · Essentials · 7 min

Token counts decide how long your input can be, how long the answer can be, and what each request costs.

A model does not read letters or whole words. It reads tokens: small chunks of text, often a whole short word, a piece of a longer word, a space plus a word, or a punctuation mark. "Cat" might be one token; "unbelievably" might be three.

For English text a useful rule of thumb is that one token is roughly four characters, or about three quarters of a word. So 1,000 words is very roughly 1,300 tokens. Other languages, code, numbers and unusual spellings often take more tokens per word. Each model family splits text slightly differently, so the same sentence can have a different count on different models.

Why you should care:

  • Cost. Paid AI services usually charge per token. Tokens you send in (input) and tokens the model writes back (output) are counted separately, and output tokens usually cost more.
  • Length limits. There is a limit on how many tokens a model can consider at once and on how long one answer may be. Both are counted in tokens.
  • Speed. The model writes one token at a time, so a longer answer takes longer to arrive. That is why chat apps show the text appearing gradually.

Most providers show a token count for each request in their dashboard or in the response, and offer a tool to count tokens before you send. In automation tools you will often see a "max tokens" or "maximum length" setting: it caps how long the answer may be. Set it too low and the answer is cut off mid-sentence.

Example

Text:    "Unbelievably, the cat sat."
Tokens:  "Un" | "believ" | "ably" | "," | " the" | " cat" | " sat" | "."
Count:   8 tokens for 4 words (the exact split depends on the model)

Remember

  • Tokens are word pieces; roughly 4 characters or 0.75 English words each
  • Input and output tokens are counted (and usually priced) separately
  • A max-tokens setting caps answer length; too low cuts answers off

Watch out for

  • Estimating cost or limits in words; providers count tokens, and non-English text or code can use many more.

Check yourself

  1. An automation's AI step keeps returning answers that stop mid-sentence. What is the most likely cause?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: platform.claude.com/docs/en/build-with-claude/token-counting