Choose language

PL, EN, ES, DE, FR, RU


Rail Fence, Zig-Zag - online encoder / decoder


Rail Fence, Zig-Zag cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Rail Fence, Zig-Zag cipher.
Rail Fence (Zig-Zag) is a translation cipher. The cryptogram is created by combining a sequence of letters based on the simplified shape of the fence. Using our encoder you can both encrypt and decrypt each text with a fence cipher. Enter the height of the petal, i.e. the number of rows, and enter by how many rows down the first coded letter is to be shifted. Then select whether the encoder should show the picket fence. If you choose this option, you can change the character separating the letters.





Rail Fence, Zig-Zag - encoder / decoder


Number of rows (key) 

Move down 









Have you counted? - like and share









Rail Fence, Zig-Zag - encoder / decoder


Rail Fence or the Zig-Zag cipher is a transposition cipher. The cryptogram is created by combining a sequence of letters based on the simplified shape of the fence. Successive letters of the plaintext are written alternately in n rows in such a way that they form the shape of the upper edge of the fence.

The fence cipher was known and often used in ancient times. The ancient Greeks even developed a special tool called scytale to make it easier to encrypt and decrypt messages.

To encrypt the plaintext with a hurdle cipher, the letters of the text must be written vertically in rows, so that each subsequent letter is shifted to the right by one character. The record should resemble the top edge of the fence rungs.

The written letters are read horizontally in order from highest to lowest row.

For encryption, we use a digital key that indicates the height of the fence, i.e. the number of lines of text. We can additionally use an offset to indicate the line from which we start typing the letters of the plaintext.

For example, if we want to encode the word CALCOOLATOR we set the key first. Let's assume that our key is the number 3 , which determines the number of lines. Then write the letters of the text individually in each of the lines in separate rows, i.e. so that they form the pattern of the upper edge of the petal rungs.

C---O---T--
-A-C-O-A-O-
--L---L---R

Now we read the created ciphertext. Each letter of the ciphertext is read successively from the first line to the last. The scrambled word CALCOOLATOR when read from the ciphertext will be COTACOAOLLR

If we set the key to 5 then our fence will look like this:

C-------T--
-A-----A-O-
--L---L---R
---C-O-----
----O------

The ciphertext will be CTAAOLLRCOO . Adding to this the offset 2 , i.e. starting from the 3rd line after coding, we get LOACOTACOLR.

------L----
-----O-A---
C---O---T--
-A-C-----O-
--L-------R



Users of this calculator also used

Caesar cipher - encoder / decoder

Caesar cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Caesar cipher. You can use any shift and additionally a key for more precise text encoding.

Affine cipher - encoder / decoder

Affine cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Affine cipher.

Force, mass and acceleration calculator

With this calculator you can calculate the force, mass and acceleration from Newton's Second Law of Motion.

Bacon cipher - encoder / decoder

Bacon cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Bacon cipher.

ROT13 cipher - encoder / decoder

ROT13 cipher online encoder and decoder. Encrypt and decrypt any cipher created in a ROT13 cipher. You can use any shift and additionally a key for more precise text encoding.

Rectangle - diagonals, area, perimeter, sides

Rectangle calculator will help you calculate the diagonal of the rectangle, the side length, height, area of the rectangle.

Trifid cipher - encoder / decoder

Trifid cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Trifid cipher. You can use any shift and additionally a key for more precise text encoding.



Online calculator