Rail fence cipher
The rail fence cipher writes the message in a zigzag over a number of rails and reads it off row by row. It is a transposition cipher: every character keeps its identity but changes position. Pick the number of rails to encrypt or decrypt.
Break without the rail count
Paste rail fence ciphertext and the solver tries every rail count up to twenty, ranking each by how much the result looks like English.
| Rails | Fitness | Preview |
|---|
About the rail fence cipher
Write the message diagonally downwards, bounce off the bottom rail, climb back to the top, and repeat: the path traces the pickets of a fence. With three rails, WE ARE DISCOVERED becomes a top row taken from every fourth letter, a middle row from the letters in between, and a bottom row from the valleys. Reading the rows left to right produces the ciphertext.
Because it only rearranges letters, the ciphertext keeps the exact letter frequencies of English — the cipher identifier flags that combination as a transposition. And since the key is a single small number, trying every rail count breaks it instantly, as the solver above shows. Militaries used it only for low-value traffic, often adding a second transposition on top.