ToolPuma Logo

Rail Fence Cipher

Encrypt or decrypt text with the rail fence transposition.

Note: The rail fence cipher writes the message in a zig-zag pattern across a set of rails, then reads it off row by row. Use the same number of rails to decrypt that was used to encrypt.

What Is a Rail Fence Cipher?

The Rail Fence Cipher tool encrypts and decrypts text by writing it in a zig-zag pattern across a number of rails, then reading it row by row. It is a transposition cipher that scrambles the order of characters rather than replacing them.

How to Use This Rail Fence Cipher

  1. 1
    Enter RailsType the number of rails (at least 2).
  2. 2
    Enter TextType the plaintext or ciphertext.
  3. 3
    Choose DirectionClick Encrypt or Decrypt with the same rail count.

Frequently Asked Questions

More rails spread the message over more rows, creating a more complex permutation. The same rail count must be used for encrypting and decrypting.
No. There are few possible rail counts, so it is trivial to try them all. It is a classic transposition for education and puzzles.