Home / Rail Fence Cipher

Rail Fence
Cipher

Encode or decode the classic zig-zag transposition cipher by selecting the number of rails.

YOUR WORKBENCH

Rail Fence Cipher

● Runs locally

More rails create a more complex zig-zag pattern. Two or three rails are a good place to start.

→

What is a Rail Fence cipher?

The Rail Fence cipher writes a message diagonally across a chosen number of rows, then reads it one row at a time. It is a transposition cipher: the letters stay the same but their positions move.

How to use the Rail Fence cipher

  1. Choose the number of rails.
  2. Select Encode for plain text or Decode for cipher text.
  3. Enter your message and copy the result.

Is Rail Fence secure?

No. It is a historic cipher useful for learning, puzzles and demonstrations, not for protecting sensitive information.

Related tools