HomeCiphers › Rail Fence

Rail Fence

Zig-zag the letters down the rails, then read each rail on its own. Nothing is swapped for anything else.

Rail Fence

Press Run it to start the machine.
0 / 0
Result

How it works

Write your message in a zig-zag, like a fence: first letter high, next letter low, next letter high. Then read all the top letters, then all the bottom letters. Nothing is swapped for anything else — the letters just move house.

  1. Add null letters so the message splits into groups of four.
  2. Zig-zag the letters down the rails.
  3. Read rail 1, then rail 2, then rail 3.

The story

Sparta, about 400 BC

The stick that read the message

Spartan commanders carried a wooden rod called a scytale. You wound a strip of leather round it in a spiral, wrote along the length of the rod, then unwound the strip. What was left was a jumble of letters. Only a rod of exactly the same thickness would line them up again. The letters were never changed, only moved — the same idea as the rail fence.

Crack these

What has hands but cannot clap?
What runs all day but never gets tired?
← Nomenclator All the ciphers Twisted Path →

Take it off the screen

Print this page and you get a worksheet: how the cipher works, where it came from, and the puzzles to crack, with the machine and the menus left off.

Print this page as a worksheet Try the challenges

Read more elsewhere

Longer, harder and written for grown-ups. Worth a look when this page runs out.

Rail fence cipher