What is the Rail Fence Cipher?

The rail fence cipher (also called a zigzag cipher) is a form of transposition cipher. When using the cipher, the text is written in a zig-zag form along a pre-agreed number of rails. For example, 'WE ARE DISCOVERED. FLEE AT ONCE' is written as

  W       R       I       V       D       L       A       N
    E   A   E   D   S   O   E   E   .   F   E   _   T   O   C
      _       _       C       R       _       E       _       E
(Spaces written as underscores here for readability)

This is then flattened to the ciphertext WRIVDLANEAEDSOEE.FE TOC CR E E

Breaking the Rail Fence Cipher

The number of possible settings for a rail fence cipher are extremely limited. Combined with the processing power of computer today, it is feasible to simply try the different settings in an online tool until the ciphertext is decrypted. Thus, there is no need for auto-solvers.

Tools for the Rail Fence Cipher

  • Encrypt text with Bifid cipher using this CyberChef recipe
  • Decrypt text encrypted with Bifid cipher using this CyberChef recipe