1001Ferramentas
🗝️Security

Columnar Transposition Cipher

Encrypts or decrypts text by writing it in rows under a keyword and reading the columns in alphabetical key order, padding the last row with X.

Result

Columnar transposition: the same letters, another order

Every classical cipher does one of two things: substitute letters or move them around. Columnar transposition is the second kind, and that changes what cryptanalysis can do. Letter frequency in the ciphertext is identical to the plaintext's — it stays full of the same common letters — because no letter was swapped. What changed was the order.

The text is written in rows under a keyword and then read down the columns, in alphabetical order of the key's letters. Enter the key and the text and pick the direction: the page builds the grid, orders the columns and reads them off, or undoes the process. The text is padded with X when it does not fill the last row, so every column has the same height.

Recognising a transposition is easy precisely because letter frequency stays normal — if the ciphertext distribution looks like the language's but the text is unreadable, it is transposition. Breaking it means trying key lengths and column orders, hunting for the digrams that make sense in the language. That is why transposition usually appears combined with substitution: applying both destroys the order and the identity of the letters.

Frequently asked questions

Where does the column order come from?
From the alphabetical order of the key's letters. With the key ZEBRA, the A column is read first, then B, E, R and finally Z. Repeated letters in the key are broken by position, left to right.
Why the X at the end?
To complete the last row of the grid. Without it, some columns would be shorter than others, and whoever deciphers would have no way to know which — which would scramble the reconstruction. Padding fixes that at the cost of a few extra characters.
What is double transposition?
Applying the process twice with different keys. It saw considerable use in the twentieth century, intelligence services included, because the second pass destroys the patterns the first leaves behind. Done by hand with long keys, it held up well by the standards of its time.

Related Tools