What Are AI Tokens? A Simple Guide to Tokens in LLMs

AI tokens are the units of text that large language models process. A token might represent a whole word, part of a word, punctuation, or a sequence of characters that includes whitespace. Before an LLM can work with text, a tokenizer breaks that text into tokens and maps those tokens to numerical IDs the model can process.

That means tokens are not the same thing as words. A short word might be represented by one token, while a longer or less common word might be split into several. The exact result depends on the tokenizer being used.

OpenAI describes tokens as the building blocks of text its models process and notes that characters, partial words, punctuation, and spaces can all contribute to token counts. It also states that tokenization varies by model and encoding. (OpenAI)

In this guide, AI tokens means tokens used by language models and other generative AI systems, not cryptocurrency tokens.

What Is a Token in AI?

A token is a discrete unit created when a tokenizer converts text into a form an AI model can work with.

Consider the word encoding.

A tokenizer does not have to treat that as one indivisible word. OpenAI's tiktoken documentation uses it as an example of how Byte Pair Encoding can identify common subword pieces, noting that an encoding may split it into pieces similar to:

encod
ing

The exact split depends on the tokenizer. The important point is that an AI token is determined by a tokenization system, not by the spaces humans use to identify words. (OpenAI tiktoken)

Tokens can therefore represent different kinds of text pieces:

  • complete words
  • parts of words
  • individual characters
  • punctuation
  • spaces combined with other text
  • symbols or other character sequences

Different tokenization systems make these decisions differently.

Tokens are not the same as words or characters

It helps to separate three concepts:

Unit What it represents Example
Character A single written character A
Word A linguistic unit people recognize running
Token A unit chosen by a tokenizer running, or several smaller pieces

A word count asks how many human-readable words appear in some text. A character count asks how many characters it contains. A token count asks how a particular tokenizer represents that text.

Those numbers will not necessarily match.

Why Do LLMs Use Tokens?

Why not simply make every word a token?

One problem is vocabulary size. Natural language contains enormous numbers of words, names, spelling variations, technical terms, compound words, and previously unseen expressions. A system that depended on having one vocabulary entry for every possible word would have trouble handling text outside that fixed vocabulary.

At the other extreme, a model could work with much smaller units such as individual characters, but that can create much longer sequences.

Subword tokenization provides a middle ground.

Common words or character sequences can be represented efficiently, while less common words can be assembled from smaller reusable pieces.

Research on subword modeling demonstrated how rare and previously unseen words could be represented as sequences of smaller units instead of requiring every possible word to exist as a separate vocabulary entry. (Sennrich, Haddow, and Birch, ACL 2016)

Byte Pair Encoding, or BPE, is one well-known approach. OpenAI's tiktoken, for example, is a BPE tokenizer. BPE is not the only tokenization approach. Other systems use methods such as WordPiece and Unigram tokenization. (OpenAI tiktoken) (Hugging Face)

You do not need to understand the mathematics of those algorithms to understand AI tokens. The important idea is that a tokenizer creates a manageable vocabulary of reusable pieces that can represent a much wider range of text.

How Tokenization Works

The exact implementation differs between tokenizers, but the basic process can be understood in four steps.

1. Text enters the tokenizer

Suppose you send an LLM a sentence such as MarkForge helps prepare Markdown for AI.

The model does not simply receive that sentence as a collection of human-defined words.

The text first goes through the tokenizer associated with that model or system.

2. The tokenizer divides the text into token pieces

The tokenizer applies its vocabulary and tokenization rules to determine how the text should be divided.

A simplified illustration might look like this. Original text:

tokenization

Possible token pieces:

token
ization

That split is only illustrative. Another tokenizer could divide the same word differently or represent it as a single token.

This distinction matters. You should not assume that a token boundary occurs wherever there is a space between words.

3. Token pieces map to token IDs

Once the tokenizer identifies the pieces, those pieces can be mapped to numerical IDs from its vocabulary.

Conceptually:

"token"     → 1234
"ization"   → 5678

Those numbers are illustrative, not real IDs from a particular tokenizer.

A token ID should not be confused with the token's meaning. It functions as an identifier for an entry in the tokenizer's vocabulary.

Microsoft's documentation demonstrates this process by showing text converted into a sequence of token IDs, while Hugging Face's tokenizer documentation similarly distinguishes tokens from the integer input IDs passed toward a model. (Microsoft Learn) (Hugging Face)

4. The model processes numerical representations of those tokens

Token IDs provide the bridge between text and the numerical operations used by the model.

Inside the model, each token ID is mapped to a learned numerical representation, often called an embedding. The model then processes those representations together with information from the surrounding token sequence.

A text-generating LLM produces its response as another sequence of tokens, which is ultimately decoded back into readable text. (Microsoft Learn)

A useful simplified flow is:

Text
↓
Tokenizer
↓
Token pieces
↓
Token IDs
↓
Learned representations
↓
Contextual model processing
↓
Predicted output tokens
↓
Readable text

This is more precise than saying that an AI simply "turns words into numbers." There are several distinct steps between the text you enter and the representations processed by the model.

A Simple AI Token Example

One of the easiest ways to understand tokens is to look at how small text differences can change tokenization.

OpenAI's documentation gives examples using the word red. Its tokenizer examples show that differences such as capitalization, whitespace, and where a word appears can produce different token representations. (OpenAI)

For example, these strings should not automatically be assumed to have identical token representations:

red
 Red
Red

To a person, they clearly contain the same basic word.

Depending on the tokenizer, those differences in capitalization, whitespace, and position can produce different token representations.

This is one reason token counting is not the same as counting words.

Why Can the Same Text Have Different Token Counts?

There is no single universal tokenizer shared by every LLM.

The same paragraph can therefore produce different token counts depending on which model and tokenizer you use.

Different tokenizers use different vocabularies and algorithms

A tokenizer has a vocabulary that determines which text pieces can be represented as individual tokens.

Different vocabularies lead to different possible splits.

One tokenizer might represent a word with one token. Another could represent the same word using two or more tokens.

Tokenizers can also use different tokenization approaches. BPE, WordPiece, and Unigram are examples of subword methods used across modern NLP tooling. (Hugging Face)

Language and writing system can affect tokenization

Tokenization also depends on the characters and text patterns the tokenizer was designed to represent.

This is why a simple words-to-tokens formula cannot be applied reliably across every language.

OpenAI specifically notes that token-to-word relationships can vary between languages and that tokenization depends on the model and encoding. (OpenAI)

Spaces, punctuation, capitalization, and unusual text can matter

Changing something that looks minor to a person can alter the resulting token sequence.

Depending on the tokenizer, differences may include:

  • spaces
  • punctuation
  • capitalization
  • symbols
  • uncommon words
  • URLs
  • code
  • unusual character combinations

OpenAI's examples using forms of red illustrate how capitalization, whitespace, and placement can affect tokenization. (OpenAI)

Tokenizers can change between model generations

Even within one AI provider, tokenizer behavior is not necessarily permanent.

Anthropic's token-counting documentation warns that tokenizer changes between model generations can affect counts and recommends counting against the model that will actually be used rather than assuming a previous count still applies. (Anthropic)

Specific models and tokenizer versions will change over time. The durable lesson is more important:

When a model-specific token count matters, use the tokenizer or official counting method for the model you plan to use.

Input Tokens vs. Output Tokens

When you use a text-generating AI system, token usage is often divided into at least two broad categories.

Input tokens

Input tokens represent information supplied to the model.

Depending on the application, that can include content such as:

  • your prompt
  • instructions
  • conversation history
  • documents
  • retrieved context
  • other text sent as part of the request

Output tokens

Output tokens are the tokens generated as the model produces its response.

OpenAI's documentation distinguishes input tokens from output tokens and describes responses as sequences of generated tokens that are converted back into text. (OpenAI)

Some providers expose additional usage categories. OpenAI, for example, currently documents cached tokens and reasoning tokens in some API workflows. These are provider-specific accounting details rather than separate concepts you need in order to understand basic tokenization. (OpenAI)

Why AI Tokens Matter

Tokens may sound like an implementation detail, but they affect several practical parts of working with LLMs.

Context windows

An LLM can only process a certain amount of information within its available context.

That capacity is generally measured in tokens.

Depending on the system, the context can include the prompt, instructions, conversation history, documents or other supplied information, and space needed for generated output.

This is why a document that looks manageable by page count can still become important to measure in tokens before sending it to a model.

Exact context limits differ by model and can change over time, so a current model's official documentation should be used when a specific limit matters.

API usage and cost

Many AI APIs measure usage in tokens.

Input and output tokens may be accounted for separately, and pricing rules vary by provider and model. OpenAI currently prices API usage according to token categories, while Anthropic identifies cost management as one reason to count tokens before sending a request. (OpenAI) (Anthropic)

Because prices and billing rules change, a general token guide should not be treated as a current pricing reference. Always check the provider's official pricing documentation when actual cost matters.

Working with long documents

Token counts become especially useful when working with large amounts of text.

You might need to know the approximate size of a document before:

  • adding it to an LLM prompt
  • combining it with other reference material
  • splitting it into smaller chunks
  • preparing documents for retrieval-augmented generation, or RAG
  • fitting content into a target context budget

A 50-page report, a long Markdown file, and a large block of source code may have very different token characteristics even if their file sizes look similar.

Thinking in tokens gives you a measurement that is closer to how an LLM encounters the text.

How Many Words Are in a Token?

There is no fixed words-to-tokens conversion.

For English, OpenAI currently gives a rough rule of thumb of approximately:

  • 1 token for every 4 characters
  • 1 token for about three-quarters of a word

These are estimates, not formulas. The actual count depends on the tokenizer and the text being processed. (OpenAI)

That difference becomes more important with other languages, uncommon vocabulary, code, punctuation-heavy text, and tokenizer changes.

If you need a model-specific count, use the tokenizer or official counting method for the model you plan to use rather than estimating from word count.

How to Check the Token Count of Your Text

There are two broad ways to check token usage.

An estimate is useful when you simply need a rough idea of how large a piece of text is.

Tokenizer-specific counting is better when you need to know how a particular supported tokenizer represents the text.

For OpenAI models, OpenAI provides tokenizer resources and the tiktoken library for tokenizer-specific counting. (OpenAI)

You can also use the MarkForge AI Token Counter to inspect text without manually estimating from word count.

MarkForge provides a general AI token estimate as well as exact local counting for its supported OpenAI tokenizer modes, o200k_base and cl100k_base. The general estimate should not be treated as an exact count for every AI model, and MarkForge does not claim exact tokenization for model families it does not support.

That distinction matters because token counts depend on the tokenizer associated with the model being used.

Common Misconceptions About AI Tokens

"One token equals one word"

No.

Some words may be represented by a single token, but others can be split into multiple tokens. Tokens can also include punctuation, partial words, whitespace combined with text, and other character sequences. (OpenAI)

Word count and token count measure different things.

"A token ID contains the token's meaning"

Not by itself.

A token ID identifies a tokenizer vocabulary entry. Inside the model, that ID is mapped to a learned representation that is then processed in the context of the surrounding sequence.

The token ID and the representation the model works with are related parts of the pipeline, but they are not the same thing. (Microsoft Learn) (Hugging Face)

"Every AI model counts tokens the same way"

No.

Different tokenizers can have different vocabularies, algorithms, and token boundaries. Even a provider changing the tokenizer used by a newer model can change the count for identical input text. (OpenAI) (Anthropic)

"More tokens make a prompt better"

No.

Token count tells you something about how much tokenized information is being processed. It does not measure whether a prompt is clear, accurate, relevant, or well designed.

Adding unnecessary text can increase token usage without making a request more useful.

Frequently Asked Questions

What is a token in an LLM?

A token is a unit created when an LLM's tokenizer divides text into pieces that can be mapped to numerical IDs and processed by the model. Tokens can represent entire words, parts of words, characters, punctuation, or other character sequences.

Is a token the same as a word?

No. Some words may correspond to one token, while others may require multiple tokens. A tokenizer can also create tokens from punctuation, whitespace combined with text, and smaller character sequences.

Why do different AI models give different token counts?

Different models can use different tokenizers, vocabularies, encodings, or tokenization algorithms. Those differences can cause the same text to be divided into different token sequences.

Do spaces and punctuation count as tokens?

Spaces and punctuation can affect tokenization, but that does not mean every space or punctuation mark always becomes its own separate token. Their treatment depends on the tokenizer.

Are AI tokens the same as cryptocurrency tokens?

No. In the context of LLMs, tokens are units used to represent and process information. Cryptocurrency tokens are digital assets associated with blockchain systems. They share the word "token," but they refer to different concepts.

The Bottom Line

AI tokens are the units that connect human-readable text to the numerical processing performed by large language models.

A tokenizer divides text into token pieces, maps those pieces to IDs, and prepares them for the model. Those token boundaries do not necessarily match words, and different tokenizers can represent the same text differently.

That is why tokens matter when working with context limits, API usage, long documents, and AI workflows. A rough estimate can help with planning, but when model-specific accuracy matters, the count should come from the tokenizer or official counting method associated with the model you intend to use.

If you want to inspect your own text, the MarkForge AI Token Counter can provide a general estimate or count using its supported OpenAI tokenizer modes.