Rail fence cipher solver
Brute-force rail fence transposition across 2-8 rails and every starting offset, ranked by English-likeness.
Open in ctfpalRail fence is a transposition: the letters are unchanged, only their order moves. Write the plaintext in a zigzag across N rails, then read off row by row. Because the letters are preserved, frequency analysis says nothing useful - the ciphertext has exactly English letter frequencies while being unreadable.
That is itself the diagnostic
If a ciphertext has a normal English letter distribution but reads as nonsense, it is a transposition, not a substitution. That single observation separates rail fence, columnar transposition, and scytale from every cipher on this page - and tells you not to waste time on frequency attacks.
The rail fence keyspace is tiny: the number of rails, plus an optional starting offset. Trying 2 through 8 rails against every offset is a few dozen candidates, all scored automatically. Longer keys are possible but rare, because the zigzag stops obscuring anything much past 8 rails on short text.
Worked example
Three rails
Input
WECRLTEERDSOEEFEAOCAIVDENResult
WEAREDISCOVEREDFLEEATONCEThe canonical example. Note the ciphertext letters are exactly the plaintext letters, reordered.
Load this example in the workspace