codebreaking spy
codebreaking logo

Transposition Ciphers

Transposition Ciphers

As their name suggests, in transposition ciphers, the letters of the message to be encoded -what cryptographers call the ‘plaintext’ - are simply rearranged (or ‘transposed’) forming an anagram . However, in order for this kind of cipher to be of practical use, this rearrangement must follow some kind of system, in order that the recipient may be able to decode it.

Railfence Ciphers

The railfence cipher is a simple system for sending encoded messages that first appeared in the US Civil War. It gets its name from the old-fashioned American fence built without the use of nails. Looked at from above, the fence looked like a zigzag. Take the sentence:


Then write the letters on alternate lines to make your ‘railfence’:

I   M   C   D   B   E   K   R  
  A   A   O   E   R   A   E   A

Note that we have added an extra letter ‘A’ to pad the text. This makes sure that all the rows are filled. As we only needed to pad by one letter we used the letter ‘A’. If we had to pad four lines we would use the letter ‘D’ as it is the fourth letter of the alphabet. You should then have the sentence IMCDBEKRAAOERAEA. To break the code the recipient simply needs to split the ciphertext in two and reverse the process.

It is also possible to use 3, 4 or more lines to write your message on:


Our new encrypted message would be read as ICBKAOREMDERAEAA

No. Lines




In Roman times, the scytale cipher was used to smuggle messages through enemy lines. Although the scytale cipher was first documented as early as the 7th century BC, it was not until 800 years later that Plutarch described how the Spartan Generals used the scytale to send secret messages. Each General or Admiral in the Spartan army was supplied with a long black staff, and an identical one was kept by the magistrate. When the they wanted to send a message, they would wrap a long strip of parchment or leather around the staff, and would write their message along the piece of wood over the leather or parchment. When the material was removed from the staff the message became unintelligible and it had the added bonus that it could be worn as a belt, or used to tie a pack, and easily transported. To be read correctly the General would wrap the strip around his matching staff until the message became intelligible.

The most famous use of the scytale in ancient history concerns Pausanias. The uncle of the King of Sparta, and leader of the Greek army, Pausanias, became greedy after his success in battle, and offered to help hand Sparta and the rest of Greece into the hands of the Persians, in exchange for the hand of the King’s daughter and an adequate dowry. However, his arrogance and haughtiness alienated his officers and led to insurrection. summoned to trial by Sparta, he was charged with minor personal misdemeanours but was acquitted of treason. He returned to Byzantium without the consent of the Spartans, where his mental stability deteriorated. Slowly driven mad, Pausanias accidently murdered his young lover, thinking she was an assassin. He fled to Troy to renew his discussions with the Persian King, only to receive a scytale that read: ‘Stay, behind the herald, and war is proclaimed against you by the Spartans.’

Pausanias submitted to trial, but still plotted to escape with the help of slaves. However, his scheme was discovered, and on his attempt he was cornered in a temple, where he thought he would be safe from death. His accusers (if legend is to be believed) blocked the windows and the doors, and left him to starve, only to breathe his last outside the temple door, unwilling to profane the sanctuary with his death.

How To Use The Scytale

step 1

The person sending the message takes a rod or similar cylindrical object. (The person who will later decipher the code also needs a rod exactly the same size for the code to work properly, but we'll come back to that later.) The coder then takes a thin strip of paper or cloth to wrap around the rod which they will use to write the coded message on.

First the paper is tighly around the rod.

scytale rod


step 2

Once the paper is wrapped around the rod the coder decides how many letters can be written in one circle around the circumference of the rod.
How many letters can be written across from left to right depends on how many times the paper is wrapped around the rod..

In our example the paper wraps around the circumference of the rod 5 times, allowing us to write 5 letters across.
There is space to write 4 letters around the rod in one complete circle.
If we multiply the number of letters around a circle by the number of letters across (4 x 5 here) we can find the total number of letters that can be contained in the entire message. In this example that total is 20 letters (4 x 5 = 20).

From what we have learnt above, we know that the message can contain up to 20 letters.
Here we have a message of exactly 20 letters (ignoring spaces):

scytale example deciphered


step 3

The message needs to be written over 4 lines (1 line for each letter allowed per circle around the circumference of the rod.) and 5 letters across.
The message is written one line at a time while the paper is still wrapped around the rod..
Each line of 5 letters becomes visible as the recipient turns the rod around away from themselves.

example readable

Here is the same message, but we've marked clearly each word, by making each one coloured alternately black or red:

example readable

Here is the paper wrapped around the rod. You can see the first line of the message written accros the rod. If we turned the rod away from our selves we would see the next line ("CLASS") and then "CODEB" and so on.

scytale rod


step 4

When the paper is taken off the rod and unravelled you can see it is quite unintelligible. (shown here sideways.)

coded message

If you look very closely at the code above you will see that the first of every four letters put together, spell the first line across the rod!

step 5

Remember we said in step #1 that to decipher the message the recipient needs to have a rod of exactly the same size?
Look what happens if the paper is wrapped around a rod which is too big.
The rod below has too big a circumference, which means every circle around the rod creates 5 lines across instead of the 4 needed. The larger rod also means that the paper can only reach to make 4 circles, which in turn means each line across can now only contain 4 letters instead of 5.
*All of this means the message can not line up properly and becomes garbled nonsense

example too big

...And here with a rod that is too small. With this one, there is only space for 3 lines across on each circle round the rod. Because the rod is thinner the paper wraps around further (6 times instead of the 5 needed.)

example too small

Scytale Puzzle

So now you know how the scytale cipher works, lets see if you can solve a few simple scytale puzzles.

step 1

Please make a selection
from the rods below.

step 1

Please make a selection
from the rods below.

step 1

Please make a selection
from the rods below.