Rail Fence Cipher
Write text in zig-zag rails and read row-by-row.
Input
Output
Using This Tool: Guide & Notes Show guide
Rail Fence writes text in a zig-zag path across rails, then reads the rows to produce ciphertext.
How to use it
- Choose the number of rails.
- Paste the plaintext or ciphertext.
- Use Encrypt to write the zig-zag and read rows, or Decrypt to reconstruct the path.
- Check the rail preview to understand the rearrangement.
Options and settings
- Rail count changes the height and rhythm of the zig-zag pattern.
- Preserve spacing controls whether spaces remain part of the visible output.
- Grouping creates classical-looking ciphertext blocks.
- Reset defaults returns to the standard simple demonstration settings.
Notes
- Rail Fence is a transposition cipher: letters are moved, not replaced.
- Very low rail counts are especially easy to recognise.
Related Article
Rail Fence Cipher: The Zigzag That Hid the Message
How one of the simplest transposition ciphers scrambled plaintext by changing where the letters sit, not what the letters are.