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

Bifid cipher - encoder / decoder

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

Playfair cipher - encoder / decoder

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

Vigenère cipher - encoder / decoder

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

ADFGX / ADFVGX cipher - encoder / decoder

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

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.

Fraction calculator - subtracting fractions step by step with explanation

With the Fractions Calculator, you can subtract any two mixed numbers or proper and improper fractions.
Fractions Calculator will show you the result of operations on fractions step by step and will give you explanations of the operations performed to subtracting fractions. You will learn how to simplify fractions, how to find a common denominator, how to find the least common multiple and the greatest common divisor.



Online calculator