STATION 25 / FIELD MANUAL

← Back to crypto library

Rail Fence

Transposition

Rail Fence writes a message along a zigzag, then transmits one rail at a time. The rail count, initial rail and initial direction determine the path.

How to recognise it

It preserves letter counts while scrambling order. A zigzag or rail-count clue is more useful than the ciphertext's appearance. Two rails simply separate alternating positions; more rails produce a different cycle.

Worked example: encrypt GARDEN with three rails

Start at the top, moving down. Dots below represent empty spaces, not transmitted characters.

Position  1 2 3 4 5 6
Rail 1    G . . . E .
Rail 2    . A . D . N
Rail 3    . . R . . .

Read rails: GE / ADN / R
Result: GEADNR
  1. Follow rails 1, 2, 3, 2, 1, 2 to place the six letters.
  2. Read top rail left to right, then middle, then bottom.
  3. The ciphertext is GEADNR.

Work backwards: decrypt GEADNR

  1. Draw six empty positions on the same zigzag path.
  2. Count marked positions per rail: 2, 3, 1.
  3. Split the ciphertext as GE / ADN / R and fill each rail horizontally.
  4. Follow the zigzag positions in order: G A R D E N → GARDEN.

Conventions and common mistakes

Do not split into equal-length rails: their position counts can differ. Starting at a different rail or moving up first changes the permutation. Keep empty spaces on the worksheet until you finish reconstructing the path.

Useful desk reference

Transposition worksheets — Mark routes and column lengths before filling letters.

Support this project

Enjoying Advent of Cypher? If you'd like to support the project and help keep it running, you can make a small donation. Completely optional, always appreciated.