Open Rail Fence and enter WEAREDISCOVEREDFLEEATONCE with 3 rails. Start on the top rail and move downward, with no offset. This 25-letter example lets us follow the whole path without removing any spaces or punctuation.
1. Mark the zigzag
| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|
| Input | W | E | A | R | E | D | I | S | C |
| Rail | 1 | 2 | 3 | 2 | 1 | 2 | 3 | 2 | 1 |
The path repeats 1, 2, 3, 2. After reaching the bottom, move straight back to rail 2; do not use rail 3 twice. The fourth letter, R, belongs on the middle rail.
2. Read each rail
| Rail | Letters | Count |
|---|---|---|
| 1 | WECRLTE | 7 |
| 2 | ERDSOEEFEAOC | 12 |
| 3 | AIVDEN | 6 |
Read top rail, middle rail, bottom rail
WEAREDISCOVEREDFLEEATONCE3 rails; top start; downward first; zero offsetWECRLTEERDSOEEFEAOCAIVDENThe top rail holds 7 letters, the middle holds 12, and the bottom holds 6: 25 altogether. Blank grid positions help you see the zigzag. They are not spaces to copy into the ciphertext.
3. Reconstruct the rails
- Draw the same 25-position zigzag, leaving the letters out.
- Fill rail 1 with the first 7 ciphertext letters.
- Fill rail 2 with the next 12 letters and rail 3 with the final 6.
- Follow the zigzag from the top, taking the next letter from each rail you visit.
Reading along the rebuilt zigzag returns WEAREDISCOVEREDFLEEATONCE. Three equal chunks would put letters on the wrong rails. Work out the rail lengths from the message length and the chosen path first.
Your turn
Use the same three-rail path for ABCDEFG. Write the contents of each rail before joining them.