The Rail Fence cipher is a classical transposition cipher that rearranges the positions of characters without changing the characters themselves. The message is written in a zigzag pattern across a chosen number of rails and then read row by row to produce the ciphertext.
For example, with three rails, the text moves diagonally down and up across the rows. Increasing the number of rails creates a different pattern and therefore a different ciphertext.
To decrypt a message, the same rail count must be used. The zigzag structure is reconstructed first, then the characters are placed back into their original positions.