StringMash.com

Columnar transposition cipher

Write the message in rows under a keyword, then read it off one column at a time, in the keyword's alphabetical order.

Conversion
32 characters
Updates as you type
Keyword ZEBRAS

Show the steps
  1. Write the message in rows under ZEBRAS: WEARED / ISCOVE / REDFLE / EATONC / E. Its letters number the columns 6 3 2 4 1 5 in alphabetical order. Read each column down, column 1 first.

Using the columnar transposition tool

Type a keyword and a message. The keyword's length sets how many columns the grid has, and the alphabetical order of its letters sets which column is read first. Decoding needs the same keyword.

Add a second keyword for double transposition: the result goes through a second grid. Leave the last row short, as most puzzles do, or fill it with X so every column is the same length. Only letters are carried, and anything else is listed below the output.

How it works

Take the keyword ZEBRAS. Number its letters in alphabetical order: A is 1, B is 2, E is 3, R is 4, S is 5 and Z is 6, so the columns run 6 3 2 4 1 5. Write WE ARE DISCOVERED. FLEE AT ONCE in rows of six under it: WEARED / ISCOVE / REDFLE / EATONC / E.

Now read column 1 down, then column 2, and so on. The message becomes EVLNACDTESEAROFODEECWIREE. This is the worked example in Wikipedia's article on transposition ciphers, and the tool gives the same answer.

If a letter appears twice in the keyword, the copy further left comes first. To decode, work out how long each column must be, cut the cipher text into columns in key order, and read across the rows.

Where it was used

Samuel Morland introduced an early form of columnar transposition in the middle of the 17th century. It became widely used in the late 19th and 20th centuries, notably by French military services, and stayed in serious use into the 1950s.

In the First World War the German army used a double columnar transposition and changed the keys infrequently. The French solved it regularly and called it Übchi, and the Germans moved to a new system on 18 November 1914. In the Second World War double transposition was used by Dutch Resistance groups, the French Maquis, the British Special Operations Executive and American OSS agents. It was thought the most complicated cipher an agent could work reliably in the field.

Breaking it

A transposition keeps every letter and only moves it, so the cipher text has the letter counts of ordinary English. Put it through frequency analysis: if E, T and A come out on top, it is probably a transposition and not a substitution.

A single transposition can be attacked by guessing the column length, cutting the text into columns and sliding them around until fragments of English appear. A keyword close to the right one already shows long runs of readable text, which is how computer searches find it.

Questions

What is the key of a columnar transposition?

A keyword or a list of numbers. Only the order of its letters matters, so ZEBRAS and the numbers 6 3 2 4 1 5 are the same key.

What is double transposition?

Encrypting the result a second time, usually with a different keyword. Type the second one in Second keyword. Decoding undoes the second keyword first.

Should the last row be filled in?

Either works if both ends agree. Filling it with X or random letters makes every column the same length, which is a little easier to decode by hand but also tells a code breaker the grid's size.

How is it different from the rail fence and scytale?

All three move letters without changing them. The [rail fence](/rail-fence-cipher) writes in a zigzag and the [scytale](/scytale-cipher) reads columns in their natural order. A columnar transposition reads its columns in an order set by a keyword.

Sources

Added and reviewed . What's new