Rail Fence Cipher Demo

EDUCATIONAL DEMONSTRATION ONLY — The Rail Fence cipher is a transposition cipher that writes the plaintext in a zigzag pattern across a number of "rails" (rows), then reads off each row to produce the ciphertext. Used since ancient times.

Privacy: this tool processes your data entirely in your browser. Nothing you paste or type is sent to the server.

Number of rows in the zigzag (2-10)

Result

Enter your values and press Calculate — the result appears here.

Worked examples

Encrypt with 3 rails

  • text = WEAREDISCOVEREDRUNATONCE
  • rails = 3
  • mode = encrypt

Result: WECRLTEERDSOEEFEAOCAIVDEN

Frequently asked questions

Is the Rail Fence cipher secure?

No. With only N possible rails, it is trivially breakable by trying each one. It has no key space to speak of.

What is a transposition cipher?

A transposition cipher rearranges the order of characters without changing them. The Rail Fence is one of the simplest examples.

💬 Discuss on BestWordz Community

Join the conversation about Cybersecurity, rail fence cipher, transposition cipher on the BestWordz Community forum.

Visit Forum →
Copied!