STATION 25 / FIELD MANUAL
← Back to crypto libraryRail 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
- Follow rails 1, 2, 3, 2, 1, 2 to place the six letters.
- Read top rail left to right, then middle, then bottom.
- The ciphertext is GEADNR.
Work backwards: decrypt GEADNR
- Draw six empty positions on the same zigzag path.
- Count marked positions per rail: 2, 3, 1.
- Split the ciphertext as GE / ADN / R and fill each rail horizontally.
- 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.
Related methods
- Route transposition — Other agreed routes for rearranging text.
- Layered ciphers — A full example using Rail Fence as a second layer.
Useful desk reference
Transposition worksheets — Mark routes and column lengths before filling letters.