How LLM Tokenization Works
A plain explanation of LLM tokenization: how text becomes tokens, how styled, reversed or mirrored text is affected, and when plain text is the better input.
Large language models do not read letters or words the way people do. Before a model processes anything, a tokenizer converts the text into a sequence of tokens, which are units drawn from a fixed vocabulary, each mapped to a number. This explains why a model can be sensitive to how text is written, and why decorative text transformations such as Unicode "fonts", reversed strings or upside-down characters can change what the model actually receives.
Is tokenization-aware formatting worth thinking about for your use?
If you send text to a language model, plain text is almost always the better input. Ordinary words in common languages map to tokens the vocabulary was built around, so the model can interpret them with the least ambiguity. The decisive tradeoff with styled or transformed text is that it may look the same or more appealing to a person, but it reaches the model as different, often rarer, character sequences. That usually means more tokens for the same content and a less familiar representation.
Transformed text is reasonable when the transformation is the point, for example when you are testing how a model handles unusual input, or when you are asking the model to produce or explain a styled effect. Use plain text whenever meaning, cost, context-window space or reliable interpretation matter more than appearance.
What tokenization actually does
Tokenization is a representation step. It does not alter your stored text. The same text is split into pieces and converted to integer IDs, and for standard tokenizers the process is designed to be reversible: decoding the IDs gives back the text. Most modern LLMs use subword tokenization, which sits between whole-word and single-character approaches. Frequent words often become a single token, while rarer words are split into several smaller pieces.
Typical pipeline (conceptual, varies by tokenizer):
text
-> optional normalization (some tokenizers rewrite certain characters)
-> pre-tokenization (split on spaces, punctuation, etc.)
-> subword segmentation (match pieces from a fixed vocabulary)
-> token IDs (integers the model receives)
-> embeddings (vectors the model computes with)
The common subword methods are byte-pair encoding (BPE), WordPiece and Unigram, which is often used through the SentencePiece library. They differ in how the vocabulary is learned and how text is segmented, but they share one idea: build a vocabulary of frequently seen pieces, then represent any input using those pieces. Byte-level BPE starts from the 256 possible byte values, so it can encode any input, including unusual Unicode, though rare characters may take several tokens each.
Exactly how a given word splits depends on the specific tokenizer and its vocabulary. Different model families use different tokenizers, so the same sentence can produce different token boundaries and different token counts. This article does not include measured token counts for any particular model. If you need exact figures, run your text through the tokenizer of the model you actually use.
How "token" differs from "word" and "character"
- A token is not the same as a word. One word can be one token or several, and a token can include a leading space.
- A token is not the same as a character. Common letter sequences are merged, while a single unusual character can be split into multiple byte-level tokens.
- In tokenization, "reverse" usually means decoding token IDs back into text. It does not mean reversing the order of letters.
What text transformations change before tokenization
The key distinction is between stored characters and visual presentation. A tokenizer only sees stored code points. It never sees how text is rendered on a screen. That is why some effects reach the model unchanged and others reach it as different text.
| Effect | What is stored | What the tokenizer receives |
| CSS mirroring or rotation | Original characters | Original characters, unchanged |
| Unicode "fonts" (e.g. mathematical bold or script letters) | Different code points that resemble letters | Different, rarer characters, unless the tokenizer normalizes them |
| Upside-down or "mirror" text built from look-alike characters | Substitute characters such as turned or reversed letters | Substitute characters, not the original words |
| Character reversal | Same characters in reverse order | A different string with different token boundaries |
| Bidirectional override characters | Original characters plus invisible control characters | The text plus the control characters |
Unicode "font" generators do not apply a font. They swap ordinary letters for separate characters, often from the Mathematical Alphanumeric Symbols block. Some tokenizers apply compatibility normalization (NFKC) before splitting, and NFKC maps many of these styled letters back to their plain equivalents. Others, including typical byte-level BPE tokenizers, operate on the raw bytes without that step. Whether styled text is flattened or kept as rare characters depends on the tokenizer, so check its documentation rather than assuming.
Reversal and multi-code-point characters
Naive reversal works on code points, not on the units people perceive as single characters. When text contains combining marks or composite emoji, code-point reversal can detach accents or break emoji apart. The model then receives that damaged sequence.
Decomposed "café": c a f e U+0301 (combining acute)
Reversed by code point: U+0301 e f a c
Result: the accent now has no base letter at the start; "e" loses its accent.
Thumbs up, medium skin tone: U+1F44D U+1F3FD (skin tone modifier)
Reversed by code point: U+1F3FD U+1F44D
Result: typically displays as a standalone color swatch followed by a default thumbs up.
Reversal that respects grapheme clusters, meaning user-perceived characters, avoids these breaks. Even correct reversal still produces text that a model has rarely seen in that form, so the result is valid but unfamiliar input.
Will transformed text stay usable once it is copied into a model or shared?
Copying carries stored characters, not appearance. CSS-mirrored text pastes as normal text. Unicode-styled, upside-down or reversed text pastes as the substituted or reordered characters, which is what a model, a search index or a screen reader will then process.
- Model input: styled or substituted characters can increase token count and reduce how reliably the model interprets the words. Both effects depend on the tokenizer and the model.
- Search and editing: plain-text search does not match styled look-alike characters unless the system normalizes them, and spell checkers generally do not recognize them as words.
- Accessibility: screen readers may announce styled characters by their Unicode names, read them inconsistently or skip them. Behavior varies by screen reader and platform, so test with the assistive technology your audience uses rather than relying on one successful rendering.
- Reading order: bidirectional override characters change display order without changing stored order, so what a person sees and what a model or screen reader processes can differ.
If transformed text must be shared where it may be read by a model, a search engine or assistive technology, provide a plain-text equivalent alongside it. When the goal is for a model to understand the content, send the plain version and describe any styling separately in words.
Gaps in this overview
No model-specific measurements were available for this article. It gives no token counts, vocabulary sizes or test results for named models, and no documented screen-reader behavior for specific styled characters. The mechanisms described follow from how subword tokenizers and Unicode work in general. For decisions that depend on exact cost or behavior, test your actual text with the tokenizer and tools you plan to use.