Rail Fence Cipher Tool
Encrypt or decrypt text with the rail fence cipher, a zigzag transposition cipher that rearranges the letters across a chosen number of rails.
1 Paste your text and pick the options
2 Your answer
Your answer shows here as you type.
How to use the Rail Fence Cipher Tool
- Type or paste the message into the text box.
- Set the number of rails. The same number is needed to decrypt.
- Choose Encrypt or Decrypt, and copy the result.
Frequently asked questions
What is the rail fence cipher?
It is a transposition cipher. The message is written in a zigzag down and up across a set number of rails, then read off one rail at a time to form the ciphertext.
What is the key for a rail fence cipher?
The key is the number of rails. The receiver needs the same rail count to lay the letters back out in the zigzag and read the message.
Is the rail fence cipher secure?
No. There are very few possible rail counts, so anyone can try each one until the text reads correctly. It only hides a message from a casual reader.
Does the rail fence cipher change the letters?
No. It only changes their positions, so the letters and their frequencies stay the same. That makes it a transposition cipher, not a substitution cipher.
Wrote something with AI? Slop Monkey rewrites it so it sounds like you, and keeps your facts.