Railfence Cipher

The railfence cipher scrambles the letters of a message. Below is an example of how to cipher a message using railfence

r i f n e
a l e c a

This is how one would encode the word "railfence":

  1. Draw up a grid as shown above
  2. Write your message in as a zig-zag like above. Ignore spaces
  3. If there is an odd number of characters, add a place filler letter in the last cell (shown in red)
  4. Copy down all the letters from the first row, then the second row

and now "railfence" becomes "rifnealeca".

Javascript Railfence encoder/decoder

Input: Output:
www.000webhost.com