Skip to content
100% local

Burrows-Wheeler transform

Encode text into its Burrows-Wheeler transform, or decode it back to the original.

Input
Output

Burrows-Wheeler transform

The Burrows-Wheeler transform (BWT) rearranges the bytes of a message into runs of similar characters, without changing which bytes are present or losing any information needed to undo it. It is the preprocessing step inside bzip2 and other compressors, since grouping repeated bytes together makes the data far easier to compress afterward. This tool runs both directions: paste text, hex or a list of byte values to encode it, or paste a previous result back in to decode it and recover the original exactly.

Encoding sorts every cyclic rotation of the input and keeps the last column of that sorted list, plus the row number of the original — written out as "row index:data". Decoding reads that pair back and rebuilds the input byte-for-byte. Input and output formats are independent, so you can encode from text and read hex, or decode from bytes and view text. Hex and bytes round-trip any byte sequence exactly; text format only stays faithful on the transformed side when every byte is ASCII, since permuting multi-byte UTF-8 characters usually breaks them. Wrap long output at a fixed width, and choose whether the row index is zero-padded.

Short or repetitive input transforms fine but shows the effect less clearly than a longer, varied paragraph — try a few sentences to see the runs form. Sorting every rotation gets more expensive as the input grows, so this tool caps how much it will transform in one pass; split larger input into pieces if you hit that limit. The tally under the output reports byte counts on each side and, for encoding, the row index produced.

Everything runs locally in your browser — nothing you paste here is ever uploaded or stored on a server. Copy the result, download it as a .txt file, or send the output straight back into the input to try the reverse direction.

FAQ

What is the Burrows-Wheeler transform actually used for?
It rearranges data into runs of repeated bytes without discarding any information. Compressors like bzip2 apply it before run-length and entropy coding, since the rearranged data compresses far better than the original.
Why does the output start with a number and a colon?
That number is the row index needed to invert the transform. The transform alone doesn't carry enough information to undo itself, so this tool stores the index alongside the transformed data — switch to Decode and paste the whole "index:data" string back in.
Why does my decoded text show a garbled character where an accented letter used to be?
That happens only if the transformed data was viewed or edited as plain text: multi-byte UTF-8 characters get scrambled by the transform and can't survive a round trip through the text format. Use the hex or bytes output format when your input has non-ASCII characters, and switch back to text only after decoding.
Is there a size limit?
Yes. Sorting every rotation of the input gets more expensive as the input grows, so extremely large pastes are rejected with a message telling you to shorten the input rather than freezing the page.
Is my text uploaded anywhere?
No. The transform and its inverse both run entirely in your browser — nothing you type or paste here ever leaves your device.