Free Online Tool

Rail Fence Cipher

Encode messages using the Rail Fence transposition cipher with zigzag pattern encryption.

How to Use Rail Fence Cipher

  1. Enter text and choose the number of rails; the examples use 3.
  2. Select Encode to write characters in a down-and-up zigzag.
  3. The output concatenates rail 1, rail 2, and rail 3 without removing spaces.
  4. Switch to Decode with the same rail count to reconstruct the zigzag positions.

Rail Fence is a transposition cipher: it changes character positions but never substitutes their values.

Examples

Classic three-rail example:

WEAREDISCOVEREDFLEEATONCE

Output:

WECRLTEERDSOEEFEAOCAIVDEN

Spaces remain characters in the zigzag:

HELLO WORLD

Output:

HOREL OLLWD

Features

Privacy Focused

All processing happens in your browser. No data is sent to servers.

Free Forever

No registration, no limits, completely free to use.