Rail Fence Cipher

Encode or decode text with the classic rail fence zigzag and any number of rails.

Rail fence encode and decode

No text converted yet.
The same rail count is needed to decode a message that was encoded with this cipher.

How to use the Rail Fence Cipher

  1. Paste the text you want to scramble or unscramble.
  2. Choose encode or decode and set the number of rails.
  3. Copy the result with the Copy button.

Features

Advertisement

Frequently Asked Questions

Common questions about the free online rail fence cipher.

It is a transposition cipher. The text is written in a zigzag across a set number of rails and then read rail by rail to scramble it.
Choose encode or decode, set the number of rails and paste your text. The result appears immediately and can be copied with a single click.
Any number from 2 upwards works. Three or four rails are typical, and more rails shuffle the characters further without adding real security.
Yes. Every rail count rearranges the text differently, so decoding needs exactly the same rail count that was used to encode the message.
You can try each rail count in turn and read the results. Short messages are easy to break this way because the cipher is quite weak.
Yes. Every character takes its place in the zigzag, so the original text comes back exactly when the same rail count is used again.
Yes. The text is split into whole characters rather than raw bytes, so emoji and accented letters stay in one piece and round-trip correctly.
No. It is a classical puzzle cipher. For real privacy use modern encryption and never rely on this for passwords or private files.
No. Encoding and decoding run entirely in your browser, so nothing you paste is ever sent anywhere.

Last updated: October 10, 2026