gizmobench

Burrows–Wheeler Transform

Explore the Burrows–Wheeler transform using an explicit sentinel or primary-index convention. Enter source text to inspect its sorted cyclic rotations and last column, or reverse a transformed string to recover the original. Copy or download the output and keep the displayed primary index when using index mode.

Include exactly one sentinel at the end of the source text. The transformed text retains it; inverse mode derives the original row from its last-column position. Sorting uses Unicode codepoint values, with no locale collation or normalization.

Primary index: 4

7 Unicode codepoints. Indexing starts at zero.

The TXT download contains the output only. In index mode, save primary index 4 separately.

Sorted rotations and last column

Read the last column from top to bottom to obtain the forward transform. The highlighted row is the original sequence. Equal rotations retain source-offset order.

RowRotationLast
0$banana"a"
1a$banan"n"
2ana$ban"n"
3anana$b"b"
4 (original)banana$"$"
5na$bana"a"
6nana$ba"a"

An exact reversible rearrangement under the displayed convention, not encryption or compression by itself. Processing stays in this browser and inputs are not saved.

Common questions

What does the Burrows–Wheeler transform do?
It sorts cyclic rotations of a sequence and reads their last column. This rearranges symbols and can group repeated characters, which may help a later compression stage. The transform alone neither compresses nor encrypts text.
What is the banana example?
With a unique trailing $ sentinel, banana$ transforms to annb$aa. Its original rotation is row 4 when rows start at zero. Inverting annb$aa under the same convention returns banana$.
How do sentinel and index modes differ?
Sentinel mode requires exactly one chosen codepoint, placed at the end of the source. It remains in the transformed text and identifies the original row during inversion. Index mode adds no sentinel; save the displayed zero-based primary index with the last column. TXT downloads contain only output text.
How are Unicode and repeated rotations sorted?
Sorting compares Unicode codepoint values, without locale collation or normalization. Emoji codepoints stay intact, but multi-codepoint grapheme clusters can be separated. Equal rotations use source-offset order; inverse mode rejects noncanonical primary indices for identical rotations.
Why is the rotation table sometimes omitted?
The table appears for inputs up to 64 codepoints. Longer input still transforms exactly up to 4,096 codepoints, but the full quadratic display is omitted to limit memory and screen use.
Does the tool save or upload text?
Processing stays in your browser. Inputs are not saved. Copy and TXT download are available after a valid result; malformed sentinel or index inputs produce an explicit error.

An exact reversible rearrangement under the displayed convention, not encryption or compression by itself.