Columnar transposition cipher — reorder columns with a keyword

Columnar transposition writes your message in rows under a keyword and reads the columns out in the keyword's alphabetical order; the letters stay the same but their order changes. Encrypt, or decrypt with the same keyword.

Live demo · real result from this tool
Direction

Result

EVLNACDTESEAROFODEECWIREE

Processed on your device — nothing is uploaded.

How to use the columnar transposition tool

  1. Choose the Direction: Encrypt or Decrypt.
  2. Enter the Keyword. The default is ZEBRAS.
  3. Keep Remove spaces and punctuation first ticked for the classic style, or untick it to keep spaces as characters in the grid.
  4. Optionally type one character in Pad the last row with (encryption only).
  5. Type into Your text and copy the Result.

What it does and when to use it

Columnar transposition shuffles the order of letters without changing any of them. It was a standard hand cipher for armies and diplomats for a long time, often applied twice in a row (double transposition) for extra strength. Today it is a classroom favourite because you can follow it on squared paper, and a regular in puzzle hunts and capture-the-flag challenges.

It is for puzzles and learning only. The letter frequencies of the original language survive, which reveals at once that a transposition was used, and anagramming attacks break single transposition. Simpler relatives are the rail fence cipher, which uses a zig-zag instead of a keyword, and the scytale cipher, which reads columns in plain order. To scramble letters by substitution instead, try the keyword substitution cipher.

How it works

The keyword sets the column count and the reading order. ZEBRAS has six letters; in alphabetical order they are A, B, E, R, S, Z, so column 5 is read first, then 3, 2, 4, 6 and 1:

Z E B R A S
6 3 2 4 1 5
-----------
W E A R E D
I S C O V E
R E D F L E
E A T O N C
E

Reading the columns in that order gives EVLN + ACDT + ESEA + ROFO + DEEC + WIREE. Column 1 has five letters because the last row is short.

To decrypt, the tool works out the length of every column from the message length, cuts the ciphertext into those pieces in key order, places them back under the keyword and reads across the rows. It runs in your browser.

Worked examples

Results from the tool:

WE ARE DISCOVERED. FLEE AT ONCE   ZEBRAS             →  EVLNACDTESEAROFODEECWIREE
same, pad X                       ZEBRAS             →  EVLNXACDTXESEAXROFOXDEECXWIREE
EVLNACDTESEAROFODEECWIREE         ZEBRAS, Decrypt    →  WEAREDISCOVEREDFLEEATONCE
Meet at noon                      BALL               →  etnMaoento

With pad X, five X letters fill the short last row, and every column becomes five letters long. The last line shows that the case is kept and that the two L columns are read left to right.

Limits and tips

  • Longer keywords with no repeated letters give more possible orders.
  • Encrypting twice with two different keywords is far stronger than once, though still not secure.
  • Word breaks disappear when spaces are removed, so the reader has to split the words again.

Frequently asked questions

What happens when the keyword has a repeated letter?
Tied letters are read left to right. In BALL, the A column goes first, then B, then the first L column, then the second L column. Some other tools number ties differently, so agree on the rule before you exchange messages.
Should I pad the last row?
It is optional. Without padding the last row can be short (an irregular grid), which is harder to break. With a pad character, such as X, every column has the same length, which makes hand decryption easier. The pad letters stay at the end of the decrypted text, so the reader removes them.
Can the keyword contain digits?
Yes. Letters and digits both count, and digits sort before letters. Spaces and punctuation in the keyword are ignored. The keyword needs at least two usable characters, otherwise there is nothing to reorder.
Why does decryption give nonsense?
Check three things. The keyword must match exactly, including repeated letters. The Remove spaces and punctuation first box applies to decryption too, so untick it if the ciphertext contains spaces that were part of the message. And if the sender padded the grid, all the pad letters must be present.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close