What is the columnar transposition cipher?

The columnar transposition cipher writes a message in rows under a keyword and reads it back out column by column, in the alphabetical order of the keyword's letters. It keeps every letter and only changes their order, which makes it a transposition cipher. An early form of it appeared in the middle of the 17th century. Applied twice, as double transposition, it was used by the German army in World War I and by resistance groups in World War II. These days it shows up in puzzle hunts, capture-the-flag games and cryptography lessons, often as the first cipher with a keyword.

How the grid works

Write the message in rows as wide as the keyword, then number the columns in the alphabetical order of the keyword's letters. With the keyword BREAD, MEET ME AT THE BAKERY fills this grid:

B R E A D
2 5 4 1 3
M E E T M
E A T T H
E B A K E
R Y

Read the columns from 1 to 5, starting under the A: TTK, MEER, MHE, ETA and EABY. Joined up and fitted back between the spaces of the message, they make the cipher text TTKM EE RM HEE TAEABY. The last row may stay short, as no filler letters are added.

Tool description

Enter your message in the Plain text box, then give the tool a keyword in the Keyword field below the Cipher menu, which starts out empty. With no letter in it, there's no cipher text yet, only the message "Enter a keyword." Once there's a keyword, the Cipher text box keeps up as you type, and the copy button under it copies the result. Insert sample brings in See you at the park at noon and the keyword PICNIC, for etk nup ne tro oety ha Saao. To decode instead, hit the swap button, and the result moves into the input. Want a different cipher, such as the rail fence? Pick it in the Cipher menu. The Columnar Transposition Cipher Decoder turns messages back into plain text. Everything here runs in your browser.

Examples

Plain text Keyword Cipher text
Picnic in the park CAKE ichrPi ta nnp ciek
Feed the ducks at noon POND ddso eek nehct nF tuao
Plant the tomatoes in May GARDEN leoan ost miPhtMta na tey
Party starts at 7:30! BALLOON ar0Pa 3rttst 7y a:st!
Crème brûlée for dessert SWEET èûosm lreCbe ete édrrrfs

What counts in the keyword

  • Of the keyword, only the letters A to Z count, capital or small. An accented letter counts as its plain letter, and digits, spaces and signs are skipped, so Picnic 2 works like PICNIC.
  • Every letter makes a column, even a repeated one: BALLOON makes seven columns. Columns under the same letter are read from left to right.
  • Only the order of the letters matters, not the letters themselves. CAKE and BAKE put their columns in the same order, so they give the same cipher text.
  • A one-letter keyword leaves the message as it is.

Spaces, digits and capitals

  • Letters and digits move, while spaces, punctuation and line breaks keep their places, so the cipher text shows how long each word is. Cipher texts are often written in groups of five letters instead: type your message in groups of five, and the gaps stay where you put them.
  • Digits move like letters: in Party starts at 7:30!, the 0, 3 and 7 end up in the first three words, while the colon stays in place.
  • Letters keep their case and accents as they move, so a capital can land in the middle of a word, as the P of Picnic in the park does.
  • Greek, Cyrillic and other alphabets are moved just like A to Z.