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 workspacePart of a module
2. Classical ciphers and frequency analysis
Break Caesar, Vigenere, and arbitrary substitution using letter statistics - and learn why statistics beat guessing.
Practise on real challenges
Related tools
Monoalphabetic substitution cipher solver
Break an arbitrary substitution cipher automatically by hill-climbing on quadgram statistics - no key, no guessing.
Cipher identifier and automatic decoder
Paste anything and find out what it is. ctfpal runs every decoder and rotation, including multi-pass cascades, and ranks results by English-likeness and flag patterns.
ADFGVX cipher decoder
Decrypt ADFGX and ADFGVX - a Polybius substitution followed by a columnar transposition, and unmistakable from its six-letter alphabet.
Caesar cipher decoder with automatic shift detection
Break a Caesar shift without guessing. ctfpal scores all 26 rotations by chi-squared letter frequency and puts the English one first.