Skip to content
ZeroServer.tools

Rail Fence Cipher

Classical transposition cipher — text is written in a zigzag across rails, then read off row by row.

Zigzag pattern (plain text → rail pattern)

W E C R L H
E R D S O E E F E A E D
A I V D E A

How the rail fence cipher works

The rail fence cipher writes the plaintext in a zigzag pattern across nimaginary rails. For example with 3 rails and text "WEAREDISCOVERED", the pattern is:

W . . . E . . . I . . . V . . . D
. E . R . D . S . O . E . E . F .
. . A . . . C . . . R . . . A . .

Reading each rail left-to-right and concatenating gives the ciphertext: WEIDVERDSOEEFARECA. Decryption reverses the process — place the known pattern of positions, fill in rows, then read diagonally. For other classical ciphers try Affine Cipher and Caesar Cipher.

Private & free — this tool runs entirely in your browser.

Recommended: IndieKit Ship your Next.js startup in days.affiliate

Related Converters tools