The Burrows-Wheeler Transform rearranges the symbols of a block so that certain contexts become easier for a later compressor to exploit. It does not remove symbols or replace repeated substrings with shorter tokens by itself. Its surprising feature is reversibility: a last-column sequence, together with the agreed boundary convention, contains enough information to recover the starting block. Looking at a deliberately small example makes the sorting rule and that boundary information visible.
For this explanation, append a unique dollar-sign terminator to the hypothetical text ABAB and order that terminator before the letters. The complete block is ABAB$. The terminator must not also occur as an ordinary input symbol under this convention. Other implementations can keep an original-row index instead of adding such a character; those are different packaging choices around the same central idea.
The sorted-rotation construction is a teaching method. It creates one row for every cyclic rotation of the complete block, then puts those rows into lexicographic order. It should not be interpreted as an efficient requirement to allocate a square matrix for a large production block. The referenced course notes explain the connection with suffix arrays, while the NIST definition presents the preceding-character relationship directly.

The five sorted rows in this example are $ABAB, AB$AB, ABAB$, B$ABA and BAB$A. Their last characters form BB$AA. Each row's last character is the cyclic predecessor of that row's first character in the original block. Sorting the rows therefore organizes those predecessor symbols according to the contexts that follow them, rather than according to the predecessor symbols alone.
The transformed sequence still contains two As, two Bs and one terminator. Neither the length nor the symbol counts have changed. Here the repeated letters happen to form compact groups, which suggests why later run handling or adaptive coding can become useful. That observation is not a guarantee that every possible input block will produce long runs or a smaller final compressed file.
Begin with five empty rows. Prepend each symbol of BB$AA to its corresponding row, then sort the rows. Repeat this prepend-and-sort operation five times, using the same last-column sequence each round. The growing rows eventually become the complete sorted cyclic-rotation matrix. The row ending with the unique terminator is ABAB$, which identifies the original boundary under our convention.
This recovery method is intentionally inefficient but demonstrates why the permutation is not destructive. Merely sorting the original characters once would lose their order. Repeatedly associating the last column with the ordered partial contexts restores the relationships that an ordinary character histogram does not contain. The figure shows selected intermediate rounds, not a suggested implementation for large blocks.

A faster inverse uses the relationship between the sorted first column and the last column. When the same letter appears several times, its first occurrence in one column corresponds to its first occurrence in the other, and similarly for later occurrences. That stable occurrence rule matters: pairing repeated As or Bs arbitrarily would discard the contextual ordering that makes the transform invertible.
Counts and ranks can represent these relationships without repeatedly building every full rotation. Their indexes and whether a rank includes the current position must be stated consistently. This article concentrates on the reversible construction, rather than presenting compressed-index search as an automatic consequence requiring no additional structures. Searching and locating results introduce their own information requirements.
BB$AA is still a symbol sequence. A later stage may turn locally repeated symbols into short descriptions, followed by entropy coding and container information. Any claim about saved bytes must include those stages and their overhead. Counting only the transformed characters would miss the boundary information, coding tables and other information needed by a real file format.
The toy example deliberately fixes its alphabet and order. Real data can contain arbitrary bytes, so a reserved terminator may require a different representation or an original-row marker. Block boundaries also matter: independently transformed blocks need the appropriate recovery information for each block. Joining transformed strings casually does not make their original boundaries recoverable without an agreed framing rule.
The useful questions are which complete strings were sorted, which column was retained, how duplicate occurrences are paired and how the original boundary is identified. The site's technical principles collection offers other data transformations, while its engineering features provide context for separating an intermediate representation from a final encoded artifact. The two illustrations use an independently constructed block and make no benchmark claims.
Primary references: NIST's transform definition and Carnegie Mellon course notes on construction and inversion. Figures are original AI-assisted concept artwork; they are not screenshots from a compression product.