Rail Fence Cipher

Encrypt and decrypt text using the Rail Fence cipher, locally in your browser.

🔒 Your data is processed locally in your browser and is never uploaded to our servers.

How it works

The Rail Fence cipher rearranges the characters of a message in a zigzag pattern across several rows, called rails. The encrypted text is then read row by row.

Examples

With 3 rails:

WEAREDISCOVEREDFLEEATONCE → WECRLTEERDSOEEFEAOCAIVDEN

Security notes

The Rail Fence cipher is a classical transposition cipher and does not provide modern cryptographic security. Do not use it to protect sensitive information.

FAQ

What are rails?

Rails are the number of rows used to arrange the message in the zigzag pattern.

What happens if I use 2 rails?

The text is arranged across two rows, alternating between them.

Are spaces preserved?

Yes. All characters, including spaces and punctuation, are preserved and rearranged.