Cryptography & Ciphers
Rail Fence Cipher Decoder
Decode a rail fence cipher with a known rail count and offset. Restore zigzag text in your browser.
This tool runs open-source code from CyberChef by GCHQ (Apache License 2.0). See open-source credits.
The decoder reconstructs the zigzag rows and reads characters in their original order.
The result contains the restored character sequence.
- Check the answer to a rail fence exercise from a textbook or worksheet.
Recover DEFENDTHEEASTWALL
Input: DNETLEEDHESWLFTAA
Settings: Rails 3 and Offset 0.
Result: DEFENDTHEEASTWALL
Rail Fence Cipher Decoder with Rails 2 turns the same input into DENSEWTLLFETEADAH. Unreadable output of the right length usually means the rail count is wrong.
Supply the original rail count and offset
- Paste ciphertext with its original spaces and punctuation.
- Remove grouping spaces added after encoding.
- Set Rails and Offset to the sender’s values.
- The decoder does not search unknown settings.
- UTF-16 code units can split an emoji.
- Rail fence does not protect secrets.