Rail fence — The message zigzags across a number of rails and is read off rail by rail.
Plaintext written along a zigzag of N rails, then read off rail by rail.
A worked example§
Encrypting a sample with the cipher itself, at build time:
MEET ME BY THE OLD CLOCK TOWER AT DAWN
Key: 3
produces the ciphertext
MMTLOOAWETEYHODLCTWRTANEBECKED
This example is generated by running the cipher when the page is built, and the round trip is checked, so it always matches what the solver does.
How it is broken§
The only unknowns are the rail count and the starting offset, so a few dozen readings cover every possibility.
History and context§
A Civil War field cipher on both sides, valued for needing no equipment beyond a stick to scratch lines in the dirt.
See also§
Columnar transposition · Skip / scytale · Route transposition · Myszkowski transposition · AMSCO transposition
Browse every cipher in the Transposition ciphers family, read the history of codebreaking, or return to the wiki main page.
Frequently asked questions§
How is the Rail fence broken?
The only unknowns are the rail count and the starting offset, so a few dozen readings cover every possibility.
What key does the Rail fence use?
rails + offset. The keyspace is unbounded in practice.
How much ciphertext do I need?
At least 8 characters for this solver to attempt it; short messages can be readable and still not be proof.
Can I break a Rail fence on this page?
Yes — the browser solver on this page handles it directly. Paste the ciphertext into the solver and press the button.