Skip to main content

Rail Fence Cipher

Rails

How to Use

  1. Enter the text you want to encrypt or decrypt
  2. Set the number of rails (default is 3)
  3. Click "Encode" or "Decode"
  4. Click "Copy" to copy the result

How It Works

The Rail Fence cipher is a classic transposition cipher that arranges plaintext in a zigzag pattern across multiple "rails," then reads off each rail to produce the ciphertext.

Example (3 rails):

Plaintext: HELLO WORLD

Pattern:
H . . . O . . . L .
. E . L . . W . R . D
. . L . . . O . . .

Ciphertext: HOLELWRDLO

常见问题

Is the Rail Fence cipher secure?
No. The number of possible keys equals the number of rails minus 1, which is very small. It's mainly used for educational purposes.
What's the difference between Rail Fence and Caesar cipher?
Caesar cipher is a substitution cipher that replaces letters. Rail Fence is a transposition cipher that rearranges the order of letters without changing them.
Can the Rail Fence cipher encrypt Chinese?
Yes. The Rail Fence cipher is a transposition cipher that only changes character order, so it works with any characters including Chinese.
Share this tool