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

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.

Beaufort cipher - encoder / decoder

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

Force, mass and acceleration calculator

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

Rectangle - diagonals, area, perimeter, sides

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

Burrows-Wheeler transform - encoder / decoder

Burrows-Wheeler transform online encoder and decoder. Encrypt and decrypt any cipher created in a Burrows-Wheeler transform.

Polygon - diagonals, height, area, perimeter, sides

Regular polygon calculator will help you calculate the diagonals of any regular polygon, side length, height, area, perimeter and radius of the circumscribed circle and the radius of the circle inscribed in a regular polygon.

Matrix 4x4 calculator

Thanks to the 4x4 matrix math calculator, you can easily calculate the determinant of the matrix 4x4, find the complement 4x4 matrix, transpose 4x4 matrix, inverse 4x4 matrix.



Online calculator