Choose language

PL, EN, ES, DE, FR, RU

# Four-square cipher - online encoder / decoder

Four-square cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Four-square cipher. You can use any shift and additionally a key for more precise text encoding.
The four-square cipher is a polygraphic substitution cipher. Each pair of plaintext letters is replaced with a different pair of letters, selected from the code table using four squares, each consisting of a 5x5 table filled with Latin letters. Using our encoder you can both encrypt and decrypt each text with a four-square cipher.
Due to the fact that there are 26 letters of the Latin alphabet and 25 in the table, choose whether you want to replace a letter with another letter (usually J-> I) or remove a letter from the table (eg the least used one). Select if you want to use a code table with the entered key for encryption, if you want to fill in each field of the table manually or randomly. If you choose encryption with a key, enter the key in the appropriate field. If you choose manual or random fill, enter letters in the upper right square and in the lower left square yourself, or fill in the table randomly.

## Four-square cipher - encoder / decoder

Key table

Use table with key:
Key in the upper right square:
Key in the lower left square:
Fill manually or randomly:

Change letter:
Change to
Skip letter:
Skip:

Have you counted? - like and share

## Four-square cipher

Four-square cipher is a symmetric encryption technique. It was invented by the famous French cryptographer Felix Delastelle.

The technique encrypts pairs of letters (double characters) and thus falls under the category of ciphers known as polygraphic replacement ciphers. This adds significant power to the encryption compared to monographic substitution codes which operate on single characters. The use of digraphs makes the four-square technique less susceptible to frequency analysis attacks, as the analysis should be performed on 676 possible digraphs, not just 26 for monographic substitution. Frequency analysis of two characters is possible, but much more difficult - and generally requires much larger cipher text to be useful.

Four-square cipher was used on all fronts during World War II by all parties to the conflict. Currently, it is considered obsolete, mainly due to effective and quick brute force attacks that can be carried out with computers.

Four-square cipher consists of a code table containing four code squares (matrices) with 5x5 fields. Each square is filled with 25 letters of the Latin alphabet. Due to the fact that the Latin alphabet contains 26 letters, one letter that is least used in the alphabet is removed or the letters are used alternatively (eg I instead of J). The upper left square and lower right contain letters sorted alphabetically from A-Z. However, the lower left and upper right square are filled with letters containing the key without repeating the letters.

For example, by setting the key to the upper right matrix PTERWSZY and the lower left DRUGI and replacing J with I our code table will look like this:

a b c d e   P I E R W
f g h i k   S Z Y A B
l m n o p   C D F G H
q r s t u   K L M N O
v w x y z   Q T U V X

D R U G I   a b c d e
A B C E F   f g h i k
H K L M N   l m n o p
O P Q S T   q r s t u
V W X Y Z   v w x y z


To encrypt the plaintext, we break it into two characters of pairs of letters. If the explicit word does not have an even number of letters then at the end we add the letter X. For example, if we want to encode the word CALCOOLATOR we divide it into pairs CA LC OO LA TO RX . At the end of the word we added X because the number of letters was odd. Our encoder will automatically add the letter X if the plaintext contains an odd number of letters.

Then we find the first letter of the pair C in the upper left square and the second letter A in the lower right square.

a b c d e  P I E R W
f g h i k   S Z Y A B
l m n o p   C D F G H
q r s t u   K L M N O
v w x y z   Q T U V X

D R U G I   a b c d e
A B C E F   f g h i k
H K L M N   l m n o p
O P Q S T   q r s t u
V W X Y Z   v w x y z


Now we read the letters from the intersection points first in the upper right square and then in the lower left square.

a b c d e  P I E R W
f g h i k   S Z Y A B
l m n o p   C D F G H
q r s t u   K L M N O
v w x y z   Q T U V X

D R U G I  a b c d e
A B C E F   f g h i k
H K L M N   l m n o p
O P Q S T   q r s t u
V W X Y Z   v w x y z


The first encoded letter pair of the clear word CA will be PU . We repeat the reading operation for each of the pairs of letters of the clear word CA LC OO LA TO RX and assign it pairs read from the code table PU FD GM CD NM MW.

More on: Wikipedia - Trifid cipher

## Users of this calculator also used

### Burrows-Wheeler transform - encoder / decoder

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

### Playfair cipher - encoder / decoder

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

### 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.

### 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.

### 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.

### Online tool for drawing graphs of any function.

With this online function graph plotter, you can draw any function. On one graph you can draw any three functions and compare their parameters. You can create graphs for many equations and functions.