Loading…

How to use Rail Fence Cipher

Type your text and set the number of rails (2-10), and the tool encrypts it by writing it in a zigzag pattern across that many rows.

Frequently asked questions

How does the rail fence cipher work?

Characters are written diagonally down and up across a number of 'rails' (rows) in a zigzag pattern, then read off row by row to produce the ciphertext. It's a transposition cipher — it rearranges letters rather than substituting them.

How many rails should I use?

Any number from 2 to 10. More rails create a more scrambled result. Note that using 1 rail leaves the text unchanged (identity).

Does decryption restore the exact original?

Yes — the tool reconstructs the zigzag pattern from the ciphertext length, so decoding an encoded message with the same rail count returns your exact original text, including spaces and punctuation.

More Text Encoding Tools

Bacon Cipher
Encode text into Baconian a/b groups of five and decode Bacon cipher back to text
Affine Cipher
Encrypt and decrypt with the affine cipher using multiplier and shift keys (a coprime to 26)
Polybius Square Cipher
Convert letters to row-column number pairs with the 5×5 Polybius square (I/J shared)
Tap Code Translator
Encode text as prisoner tap-code row,column taps and decode taps back to letters (K→C)
Beaufort Cipher
Encrypt and decrypt with the reciprocal Beaufort cipher using a keyword
Gronsfeld Cipher
Encrypt and decrypt with the Gronsfeld cipher using a numeric digit key
Vigenère Cipher
Encrypt and decrypt text with the classic Vigenère polyalphabetic cipher using a keyword
Autokey Vigenère Cipher
Encrypt and decrypt with the autokey cipher where the plaintext extends the keyword stream
Playfair Cipher
Encrypt and decrypt with the Playfair digraph cipher using a 5×5 keyword square (I/J merged)
Columnar Transposition Cipher
Encrypt and decrypt with keyword columnar transposition. Columns are read in alphabetical key order
Scytale Cipher
Encrypt and decrypt with the ancient Spartan scytale rod transposition cipher. Round-trip guaranteed
Keyword Substitution Cipher
Build a mixed cipher alphabet from a keyword and encrypt/decrypt monoalphabetic substitution text

← View all Text Encoding ToolsBrowse all 1,100+ tools →