Code tool

Rail Fence Cipher

Reorder text along a zigzag path using 2–100 rails. This is a transposition demonstration, not secure modern encryption.

In-browser processingNo account requiredPrivacy details ↗

Rails: integer 2–100. All characters, including spaces and Unicode, are retained.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter text and a rail count.
  2. Choose encrypt or decrypt.
  3. Copy the resulting text.

Rail count

The rail count must be an integer from 2 through 100. One rail returns the input unchanged and is not offered.

Characters and encoding

All JavaScript UTF-16 code units are retained, including spaces, punctuation, and Unicode. No characters are silently removed.

Educational boundary

Rail Fence is a reversible transposition exercise, not secure encryption. Do not use it to protect confidential information.

GOOD TO KNOW

Common questions

What rail counts are valid?

Positive integer counts from 2 to 100.

Are spaces preserved?

Yes. Every UTF-16 code unit is included in order.

Is it secure?

No. It is an educational cipher demonstration.