How AI reads words
Small pieces first, then a guess
Think of a box of Lego. You can't build much with one giant brick. You need lots of small bricks that fit together.
AI treats words the same way. It can't read a sentence like we do. First it cuts the sentence into small pieces called tokens. A token can be a whole word, part of a word, or a single letter. Each token has an ID number, and the AI only sees those numbers.
Then it does the one job it is built for: it guesses which token comes next. Everything an AI writes, it writes one guessed token at a time.
What is the number under each token? It is the token's ID. GPT-2 has a numbered list of 50,257 tokens, a bit like seats in a huge cinema. "Once" sits in seat 7454. Common pieces were added to the list early, so they usually have small numbers. The AI never sees the letters O-n-c-e, only the number 7454.
More detail
What's the number under each token? It's the token's ID. GPT-2 has a numbered list of 50,257 tokens, and "Once" is number 7454 on it. The number isn't worked out from the letters — it's simply where "Once" sits in the list. GPT-2 made its list by reading lots of text. It started with 256 basic building blocks (numbers 0 to 255: single letters, digits, symbols, and bits of other letters — a comma is number 11). Then, again and again, it glued together the two pieces it saw side by side most often, and gave each new piece the next number. "·the" was glued very early, so it's number 262. "Once" was made from "O" + "nce", and got 7454. So a small number usually means a very common piece. The AI never sees the letters O-n-c-e — only the number 7454.
This page uses GPT-2, a small AI that OpenAI released in 2019. It is old and simple, which makes the pieces easy to see.
6 examples: the pieces, and the guesses
· marks a space. It belongs to the token after it. Some letters, like Hindi letters or emoji, are cut into several tokens. A piece of a letter can't be drawn on its own, so it shows as �. The bracket underneath shows the whole letter.
-
You type:
Once upon a timeSplit into 4 tokens:
Once7454·upon2402·a257·time640
The number under each token is its ID. What do the numbers mean?
GPT-2's top 5 guesses for the next token:
- ,42.7%
- the6.5%
- I4.1%
- he3.7%
- there2.9%
✅ A confident guess: "," at 42.7%. GPT-2 has read many stories that start "Once upon a time, there was…".
-
You type:
The cat sat on theSplit into 5 tokens:
The464·cat3797·sat3332·on319·the262
The number under each token is its ID. What do the numbers mean?
GPT-2's top 5 guesses for the next token:
- floor7.6%
- bed6.5%
- couch5.4%
- ground5.2%
- edge4.8%
Sensible guesses, like floor, bed and couch. But GPT-2 is not sure, because many words could come next.
-
You type:
The capital of France isSplit into 5 tokens:
The464·capital3139·of286·France4881·is318
The number under each token is its ID. What do the numbers mean?
GPT-2's top 5 guesses for the next token:
- the8.5%
- now4.8%
- a4.6%
- France3.2%
- Paris3.2%
❌ Not a fact-finder. "Paris" is only 5th, at 3.2%, and "the" is 1st. GPT-2 guesses which words usually come next. It does not look up facts. Newer, bigger AIs are much better at this, but they work the same way.
-
You type:
unbelievableSplit into 4 tokens:
un403bel6667iev11203able540
The number under each token is its ID. What do the numbers mean?
GPT-2's top 5 guesses for the next token:
- "16.7%
- .15.5%
- ,9.1%
- ."5.4%
- ,"3.7%
One word, 4 tokens: "un", "bel", "iev", "able". Common words are often one token. Long or rare words get cut into pieces.
-
You type:
Hello hello HELLOSplit into 4 tokens:
Hello15496·hello23748·HELL47899O46
The number under each token is its ID. What do the numbers mean?
GPT-2's top 5 guesses for the next token:
- !12.3%
- ,4.0%
- !!!3.6%
- !!3.3%
- HELL2.9%
The same word, cut 3 different ways: "Hello", "·hello" (with its space), and "·HELL" + "O". Capital letters and spaces change the tokens.
-
You type:
नमस्तेSplit into 12 tokens:
�11976�101
�11976�106
�11976�116
�24231�235
�11976�97
�24231�229
The number under each token is its ID. What do the numbers mean?
GPT-2's top 5 guesses for the next token:
- �47.4%
- �28.0%
- ,3.9%
- <space>2.7%
- <space>1.6%
One Hindi word (it means "hello") takes 12 tokens. "Hello" in English takes 1. GPT-2 learned mostly from English, so other languages are cut into many more pieces. Here, each letter is 2 tokens. Even its guesses are pieces of letters, shown as �.
The lesson: AI does not see words. It sees numbered pieces. And it does not know facts. It guesses the most likely next piece. Today's AIs are thousands of times bigger than GPT-2, so they guess much better. But they still read tokens and guess the next one.
📅 GPT-2's guesses were made on 26 September 2026, using the terminal version of this demo. They are not random: the same sentence always gets the same 5 guesses. New guesses need the whole GPT-2 model (about 500 MB), so this page does not make them. But it does cut up your text live, below.
Split your own sentence
Type anything and see it cut into tokens, just like GPT-2 does it. Try a long word, your name, a number, an emoji or another language.
Getting the tokenizer ready in your browser…
How many tokens can an AI remember at once? See Demo 05 — watch an AI forget.
Everything on this page runs on your own device. Nothing you type is sent anywhere, and nothing is saved. This page never talks to an AI. It only uses GPT-2's list of tokens, not GPT-2 itself.
Curious how it works? The Python code behind this page is on GitHub. In a terminal, it runs the whole GPT-2 model, so it can guess the next token for any sentence.
See the code on GitHub Run it in a terminal instead