NLP Tokenization Explained: What It Changes, What It Preserves, and When to Keep Plain Text

An overview of NLP tokenization: word, subword, character and byte approaches, what they change in your text, round-trip limits, and when plain text is better.

Tokenization is the step in natural language processing where a system splits text into smaller units called tokens. Search indexes, text classifiers and large language models all depend on it. This review covers what tokenization does to your text, how the main approaches differ, whether the output stays usable outside a processing pipeline, and when you should keep the plain original instead.

What tokenization is

A tokenizer takes a string of characters and returns a sequence of segments. Depending on the method, those segments can be words, punctuation marks, word fragments, single characters or raw bytes. In model-based systems, each token is then mapped to a numeric ID from a fixed vocabulary, and the model works only with those IDs. Tokenization is therefore an analysis and encoding step, not a way of styling or presenting text.

What tokenization actually changes

Tokenization alone does not rewrite the source text. The original string stays where it is, and the tokenizer produces a separate representation of it. This sets it apart from transformations such as character reversal, mirrored lettering or Unicode "font" substitution, which change the stored characters or how they display. Many pipelines, however, run normalization before or during tokenization: lowercasing, Unicode normalization (for example NFC or NFKC), accent stripping, or separating punctuation. Those steps do change characters, and they are where information is most likely to be lost. When you evaluate a tokenizer, check its normalization settings as well as its splitting rules.

The main approaches

  • Whitespace splitting: breaks text at spaces. It is simple and readable, but it leaves punctuation attached to words and does not work for languages written without spaces between words, such as Chinese, Japanese or Thai.
  • Rule-based word tokenization: applies language-specific rules for punctuation, contractions and hyphens. Penn Treebank-style rules, for example, split "don't" into "do" and "n't".
  • Subword tokenization (BPE, WordPiece, Unigram): learns a vocabulary of frequent fragments from training data. Common words stay whole, and rare or new words are built from smaller pieces.
  • SentencePiece: a subword framework that treats whitespace as an ordinary symbol, so it can work directly on raw text in any language and reconstruct the original spacing.
  • Character-level tokenization: one token per character. Usually this means one token per Unicode code point, which is not always one visible character.
  • Byte-level tokenization: works on the underlying UTF-8 bytes. No input is ever out of vocabulary, but a single visible character can span several tokens.

Worked examples

The examples below are illustrations of the mechanisms, not output captured from a specific tool. Subword splits in particular depend on the vocabulary a tokenizer learned, so real tools will split differently.

Input:        Don't split New York carelessly.

Whitespace:   [Don't] [split] [New] [York] [carelessly.]
Rule-based:   [Do] [n't] [split] [New] [York] [carelessly] [.]
Subword (hypothetical vocabulary):
              [Don] ['t] [split] [New] [York] [care] [less] [ly] [.]

In this example, the whitespace output leaves the period attached to the last word. The rule-based output separates it but also splits the contraction, and it treats "New York" as two tokens with no record that they form one name. The subword output keeps common words whole and breaks the rarer word into fragments. None of these outputs is wrong. Each one makes a different trade-off between readability, consistency and vocabulary coverage.

Character-level methods meet a Unicode subtlety. What a reader sees as one character can be stored as several code points. A code-point tokenizer separates these, while a grapheme-aware segmenter that follows the Unicode text segmentation rules (Unicode Standard Annex #29) keeps each visible character together.

"é" precomposed   -> U+00E9                              -> 1 code point
"é" decomposed    -> U+0065 U+0301                       -> 2 code points
"👨‍👩‍👧" family emoji  -> U+1F468 U+200D U+1F469 U+200D U+1F467 -> 5 code points, 1 visible character

Two practical consequences follow. First, the same visible word can produce different tokens depending on whether its accents are precomposed or decomposed, unless the pipeline normalizes them first. Second, a code-point or byte tokenizer can break an emoji or accented letter apart. Any later step that truncates or reverses at token boundaries can then leave orphaned combining marks or broken emoji.

Does tokenized output stay readable and usable?

Token sequences are built for machines, not human readers. Many subword schemes add marker characters: WordPiece prefixes word-internal pieces with "##", SentencePiece marks word starts with "▁", and GPT-2-style byte-level BPE vocabularies display a leading space as "Ġ". If you copy a token list into a document or message, these markers come along, and the result is harder to read than the original.

Whether you can recover the original text depends on the method. SentencePiece is designed to be lossless, so its tokens can be joined back into the exact input. Rule-based word tokenizers often discard spacing information, so rejoining the tokens can produce text like "Do n't" unless a matching detokenizer is used. Normalization steps such as lowercasing or accent stripping cannot be undone at all. If you need the exact original later, store it separately and do not try to reconstruct it from tokens.

For search, mismatched tokenization causes missed matches. If your content is tokenized one way and a query or index tokenizes it another way, for example splitting or not splitting hyphenated terms, results can differ. For accessibility, tokenization inside a pipeline does not affect what readers or screen readers encounter, because they still receive the original text. The risk arises only when token output itself is published. This review had no documentation or tests showing how specific screen readers handle subword markers or fragmented words, so treat token output as unsuitable for reader-facing text and always publish the plain-text version.

Comparing the approaches

Approach | Human-readable output | Handles unseen words | Exact round trip to original | Main caution
Whitespace | Yes | No | Usually yes | Punctuation stays attached; fails on unspaced scripts
Rule-based word | Yes | No | Often not without a matching detokenizer | Contractions and hyphens split by convention
Subword (BPE, WordPiece) | Partly | Yes, via fragments | Depends on implementation | Marker characters; vocabulary-dependent splits
SentencePiece | Partly | Yes | Designed to be lossless | Word-start marker character in output
Character (code point) | Low | Yes | Yes if no normalization is applied | Splits combining marks and emoji sequences
Byte-level | No | Yes | Yes at the byte level | Multibyte characters span several tokens

Is tokenization suitable for your use?

Tokenization is the right tool when text is going into a model, an index, a counter or an analysis step. Its main benefit is consistency: every downstream component sees the same units. The decisive trade-off is granularity. Word-level tokens are readable but struggle with new or rare words. Subword tokens cover nearly any input but fragment words in ways that depend on the training vocabulary. Character and byte tokens never fail on unknown input but produce much longer sequences and separate parts of a single visible character.

Plain text is the better choice whenever people will read the result, when the content must be shared, archived or indexed by systems you do not control, when assistive technology needs to present it, and whenever you need the exact original but the tokenizer or its normalization is not lossless. A sound default is to keep the original text as the source of record and treat tokens as a derived, disposable representation.

Gaps and how to check your own setup

This overview is based on documented, general behavior of tokenization methods. It includes no tool-specific measurements: no token counts, speed figures, vocabulary sizes or tested behavior of particular applications or screen readers. Because results vary by tokenizer and configuration, test with the exact tokenizer you plan to use.

  • Tokenize a sample that includes contractions, hyphenated words, numbers, and accented letters in both precomposed and decomposed form.
  • Include multi-code-point emoji and, if relevant, text in languages written without spaces.
  • Detokenize the output and compare it character by character with the input.
  • Record which normalization steps are enabled and whether they can be switched off.
  • If a model has an input limit, measure token counts on representative text instead of estimating them from word counts.