Rail Fence Cipher
Encrypts messages with the Rail Fence (zigzag) cipher, spreading letters across N rails and reading rail by rail. A classic transposition cipher for learning cryptography.
Cifrado
—
The zigzag across rails, without paper
An escape room puzzle, a geocaching hint or a classroom exercise asking for a transposition cipher on N rails. You can draw it by hand, but it is easy to miss a turn in the zigzag and burn ten minutes checking. Type the phrase, pick how many rails you want, and the ciphertext appears below, updating as you type. With the default example, OLA MUNDO on 3 rails comes out as OMOL UDAN.
The mechanic is writing letters down and up across the lines, then reading line by line from top to bottom. Two details people miss: the space travels through the zigzag like any other character, so it resurfaces in an odd position and hands an attacker a clue. And if the rail count is equal to or larger than the text length, the path never folds and the output is identical to the input. The minimum is 2 rails, and decimal values get rounded.
This page only encrypts. There is no decrypt mode, so going back means redoing the path by hand: work out how many letters land on each rail, cut the sequence into those chunks and read along the diagonal. The text field is a single line, so paragraphs with line breaks are out. Puzzle writers usually strip spaces and accents before encoding. The whole calculation happens in your browser, with nothing sent anywhere.
Frequently asked questions
How do I decrypt a Rail Fence message?
How many rails should I use?
Is Rail Fence substitution or transposition?
Related Tools
Affine Cipher with Explicit Keys (a, b)
Encrypts text with E(x) = (a·x + b) mod 26, refuses any key a that shares a factor with 26, and prints the modular inverse needed to decrypt.
Beaufort Cipher
Enciphers letters with the Beaufort cipher, a reciprocal Vigenere variant where each output letter is key minus plaintext mod 26, so the key also decodes.
Polybius Cipher
Encode text with the Polybius cipher (5x5 square, I/J merged). Each letter becomes a row/column digit pair. Useful for puzzles and classical cryptography.
Keyword Cipher
Build the cipher alphabet from the keyword you choose, followed by the remaining letters. Enciphers and deciphers, and shows the generated alphabet next to the plain one.
Hill Cipher 2×2
Encrypt text with a 2×2 matrix mod 26 (Hill cipher) — algebraic explanation and key invertibility check.
Encrypt Text
Apply classic ciphers (Caesar, ROT13, Atbash) or Base64. Useful for puzzles, CTFs and testing — do not use for real security.